str_Batch (datatype - String).{str_Batch is the name of the element for which the attribute needed to be fetched}
In Assign
IEnum_xAttribute=
(
From el In xDOC.Elements(“cXMLMessageContent”).Elements(“cXML”).Elements(“ShipNotice”).Elements(“Batch”)
Where CStr(el.Element(“BatchID”))=str_Batch
Select el.Attribute(“ProductionDate”)
)
Then used for each activity, to get value of the attribute using log message.
ERROR : For each: An ActivityContext can only be accessed within the scope of the function it was passed into.
Object name: ‘System.Activities.CodeActivityContext’.
While using str_Batch hardcoded in LINQ query i.e “37364564” it is working without any fail.
But I need to use this workflow for multiple XML File, so workflow need to be dynamic.
Hey @sahilbaglat
you can try use: (From el In xDOC.Descendants("Batch") Where el.Element("BatchID") IsNot Nothing AndAlso el.Element("BatchID").Value.Equals(str_Batch) Select el.Attribute("ProductionDate")).ToList()