Skip to main content

I know how to update attributes with variables, but I can't figure out the reverse. End users update attributes during the course of the workflow, and I need those to update the associated variable in the workflow.

Hello ,

That is less intuitive than I wished for (sic!) but technically possible.

Every time you need to read a file's attribute you must use the Find Document step: the step will return the document AND all attributes into a tidy XML. Extracting the value from that XML is then a piece of cake.

Again, I wish there was a more immediate step that does that! :)

Regards,

Carlo


Carlo to the rescue again! Many thanks!


 this has been a very helpful thread, as I had the exact same use case. I do want to add, for a non-programmer, getting the attrib out of the XML is not exactly a piece of cake!

First, it's necessary to use a C# expression to return the value of the attrib from the XML. Second, the C# code builder doesn't have the Attribs portion of the XML hierarchy in the autofind feature. So its no so easy. I had to execute the workflow, grab the XML from the Activity trace, put it in a web XML Viewer, and parse through the XML hierarchy to know what is the name of the XML field I am trying to get.

The expression I ended up with is GetVariableValue("TempDoc.Documents.Document.MetadataSOW.VendorContactEmail") , where TempDoc is the name of the variable I created to store the results from my Find Document step, MetadataSOW is the name of my Metadata / Attrib Group, and VendorContactEmail is the name of my Attrib, with spaces removed.

I hope that helps the next person who needs to solve this problem!


 

This is correct.

Another way is to use the step Evaluate XPATH to extract the value from a specific sub-node of an XML.

Returning back to @Whitney Nalle​ use case (but it can be applied to any XML use cases), the result of the FInd step is an XML containing information about the document found + all its attributes.

Evaluate XPATH step, takes as input an XML and an XPath expression and returns as output the value of the Xpath expression. We can save that value into a WF Variable directly from the Evaluate XPath step.

Find Document-> XML

XML = <Document stuff><Document attributes>

Evaluate Xpath-> XML and //Document attributes -> sub XML containing only Document Attributes (we can save this into a WF variable)

Evaluate Xpath-> XML and //Document attributes/attributegroup/attribute -> value of the attribute (we can save this into a WF variable)


Very cool


Reply