You are viewing limited content. For full access, please sign in.

Question

Question

TOKEN WITH MULTIPLE LINES TO POPULATE DIFFERENT FIELDS

asked on September 23, 2014 Show version history

In LF Workflow - I use Read XML tool to create tokes from a XML file

But, the  XML file have some different nodes and I need extract data from it. 

But, the field name is equals in both node!!!  like show 

<emit>
    <CNPJ>03274615000102</CNPJ>
    <xNome>ARQDIGITAL LTDA</xNome>

    <..................>

</emit>

<dest>
    <CNPJ>10772401000113</CNPJ>
    <xNome>COOPERATIVA DE CREDITO DE LIVRE ADMISSAO DE ASSOCIADOS DO NO</xNome>

    <..................>

</dest>
 

To retrieve values from a XML file, I was use the " //*[name() = 'CNPJ'] "  expression   and  choose the third option in the drop down - All items match (as a token of multiple value) -  in the multiple matches drop-down option. 

The token results is 2 or more lines with different values, like this:

  • 03274615000102
  • 01245784000115

The firs value is reference  to          <emit> <CNPJ> 

The second value is referenced to   <dest>CNPJ>.

Well, my question is:

Can I use this values to populate different fields? 

like this ... The first value go to E.CNPJ field,  and 

                  The second value will populate the D.CNPJ 

If yes, can you tell me how?

Best regards for all ... 

0 0

Replies

replied on September 23, 2014 Show version history

The quick answer is yes, to explain, take a look at the rest of my response.

 

You might want to ensure you are getting those values properly and not just assume one is after the other. To do that, make two tokens, with the following syntax:

//dest//CNPJ

//emit//CNPJ

Line 1 for Dest, Line 3 for Emit

 

Also, if you know they will always be in this order, you use the "Assign Field Values" activity and when you apply this token to each field, you "Right-Click" on it and select "Token Editor". From there, you can apply an index. You will want to apply an index of 1 for the first item (I believe it should be E.CNPJ) and an index of 2 for the other (D.CNPJ).

You might want to use a conditional sequence to ensure that the token has two value in it by creating a new token and applying it the value of the token with those two values with a function "Value Count" and then testing that in the Conditional Sequence to see if it contains 2 values or not. This will ensure you are not applying the same value to both fields since you won't be applying the metadata unless you have both. 

0 0
replied on September 29, 2014

Hi Joao, 

If your question has been answered, please let us know by clicking the "This answered my question" button on the response.

If you still need assistance with this matter, just update this thread. Thanks!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.