Nintex Connect

The Official Community Site for Nintex Software Products, including Nintex Workflow 2007, 2010 and 2013; Nintex Workflow for Project Server 2010; Nintex Reporting 2008 and Nintex Analytics 2010; Nintex Forms 2010; Nintex Live and Nintex SmartLibrary.
Welcome to Nintex Connect Sign in | Join | Help
in Search

Query XML Collections

Last post 08-26-2012, 11:04 AM by Vadim_Tabakman. 3 replies.
Sort Posts: Previous Next
  •  07-10-2009, 6:28 AM 5017

    Query XML Collections

    I think the answer is no already but I am going to get a definate answer. Can I query an xml as a workflow collections variable and select the pieces of information I need out of that through some of syntax, like  ArrayName.FieldName which would return the value of that field?

    Does that exist in Workflow 2007, if not, why is it, how hard would that be to develop?

  •  07-10-2009, 1:48 PM 5022 in reply to 5017

    Re: Query XML Collections

    Hi,

    If you have a number of xml fragments in a collection, you could loop through each element of the collection and perform further xpath queries on that specific element. So if you have a collection from a master xml source that looks like this:

    Item 1: <Person FirstName="Bob" Surname="Smith" />

    Item 2: <Person FirstName="John" Surname="Doe" />

    Item 2: <Person FirstName="Stacey" Surname="Jones" />

    Then, inside a for each action, you could have another query xml action that retrieves specific values from that item using Xpath (e.g Person/@FirstName) and store them in individual variables.

    We don't have any special coding syntax for this though.

    regards

    James

  •  08-01-2012, 5:28 PM 24332 in reply to 5022

    Re: Query XML Collections

    Hi,

    I've read the example above, but am not sure how to get the collection of XML fragments. Here is my situation:

    I've got an InfoPath form with the following schema:

    <my:myFields>
     <my:OPSFunding>
      <my:RequestedOPS>
       <my:RequestedOPSSources>
        <my:Source1>Bank</my:Source1>
        <my:Source2>Loan</my:Source2>
        <my:Source3>Tax Credit</my:Source3>
       </my:RequestedOPSSources>
      </my:RequestedOPS>
     </my:OPSFunding>
    </my:myFields> 

    I'm trying to gather a collection of all of the RequestedOPSSources (e.g. Bank, Loan, Tax Credit).

    In my workflow, I use a Query XML action. I set the XML source to the current item (my InfoPath form instance), provide the Xpath /my:myFields/my:OPSFunding/my:RequestedOPS/my:RequestedOPSSources, process results as text, and store the result in a collection variable called CollOPSSources. 

    When I loop through the collection, I get a single item with all of the values smashed together like this BankLoanTaxCredit. I do not have the same issue if my:RequestedOPSSources is a repeating group, which it is not. Can someone please help me understand how to get the individual values into a collection so that I can then further process them?

     Thank you!

    Filed under: , ,
  •  08-26-2012, 11:04 AM 24716 in reply to 24332

    Re: Query XML Collections

    Hi cgarcia,

    I'm not sure this is possible with XPath.  You may need to look at XSL to transform the txt into a Semi-Colon delimite text string, then split it on the semi-colon using a Regular Expression action to a Collection variable.

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems