How can I extract orderID from below 2 documents using same code if anyone can suggest? same code for both…value will definitely be different each time>
1>>
2>>
How can I extract orderID from below 2 documents using same code if anyone can suggest? same code for both…value will definitely be different each time>
1>>
Hi! use this below RegEx to get the orderID.
System.Text.RegularExpressions.Regex.Match(VariableName,“(orderID=”[0-9]+“)”).Value.ToString
Regards,
NaNi
Lets assue the XML is deserialized with the Deserialize XML activity to the variable xDoc
A minimal implementation could look like this
Assign activity:
strOrderID =
(From xe In xDoc.Descendants()
Where xe.Attributes.Select(Function (a) a.Name).Contains("orderID")
Select xe.Attribute("orderID").Value).FirstOrDefault
As an alternate, we can setup an approach based on the local name
(From xe In xDoc.Descendants()
Where xe.Attributes.Any(Function (x) x.Name.LocalName.Equals("orderID"))
Select xe.Attribute("orderID").Value).FirstOrDefault
It’s not working… could u plz help
Please always tell us what was done and what is not achieved / error message.
Also can you share the XMLs for further inspections? Thanks for Support
MainDocument (9).zip (979 Bytes)
Let me clear the process:
Hope it clears. Sorry for the inconvenience. Plz help that would be really helpful
This is .xaml for what I tried…
Sequence1.zip (2.5 KB)
Initial Requirement
looks like changed to
As the provided Code was aligned on the inital requirement for sure it will not work for an untold requirement.
Once you confirm, that requirement is fixed to:
we can start with checking some solution approaches.
Would a datable (key, value columnnames) work for you as a extraction result?
Actually it would be helpful if we can keep it to strings/ strings as I’ll also have to include the order id or invoice id in mails also.
That’s the only requirement. Thank you so much for helping
@anjasing
How about this approach for getting recognized which value was retrieved?
Can you share .xaml file if you don’t mind? That would e really helpful
@anjasing
flow:
LINQ:
(From a In xDoc.Descendants().SelectMany(Function (x) x.Attributes)
Where {"INVOICEID","ORDERID"}.Contains(a.Name.LocalName.toUpper)
Select s = String.Format("{0}:{1}",a.Name.LocalName, a.Value)).toArray
Find starter help here:
ppr_XMLBox_anjasing.xaml (6.1 KB)
Thank you so much for the help will try now
Hi,
Thank you so much for helping so much. Just wanted to ask does this have any dependency on the code except retrieving invoice id and order id from the document?? Thanks
for a better understanding of your question, may we ask you what is meant with dependencies?
the LINQ is about:
local name u mean: invoice id and order id right? I was referring to the code that u have shared what’s it dependency? (not the package)
Local name is about the XML name concept also handling namespaces
Oh Okay! Got that…Thanks for the clarification though! thank you so much
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.