Expand my Community achievements bar.

SOLVED

Addressing Node xpath fails

Avatar

Level 3

I'm having a problem pulling out data from a node.  I'm using the following XPATH expression to try to consolidate all comments into a single field (string):

concat(/process_data/ResultsXML/approvers/approver[/process_data/@Approver_index]/CommonName,':  ',/process_data/ResultsXML/approvers/approver[/process_data/@Approver_index]/Comment,'
')

I built a loop which increments the variable Approver_index and a counter called Approver_count.  The loop works perfect as when I record/playback the process loops through the expected interations.  I can see the Approver_index variable also properly increments through each loop.  Despite that, the above statement works perfect for approver[1] but never gets approver[2].  It continually processes against [1] until approver_count it satisfied.  So it never seems to pick up the updated value of Approver_index even tho in playback I CAN see approver_index incrementing.

Any ideas?  This is killing me.  I've tried a number of different methods and validated my loop logic is correct.

1 Accepted Solution

Avatar

Correct answer by
Level 10

The Asnwer is very simple !!

Your XPATH must look like:

/process_data/ResultsXML/approvers/approver[/process_data/@Appr over_index+0]/CommonName

Note that the integer variable is added with a 0.

The Adobe doesn't consider the integer variables as it is. So should either add 0 to it (OR) call Number() of function.

i.e

/process_data/ResultsXML/approvers/approver[Number(/process_data/@Appr over_index)]/CommonName

I feel this must be a bug in Adobe LiveCycle.

Nith

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

The Asnwer is very simple !!

Your XPATH must look like:

/process_data/ResultsXML/approvers/approver[/process_data/@Appr over_index+0]/CommonName

Note that the integer variable is added with a 0.

The Adobe doesn't consider the integer variables as it is. So should either add 0 to it (OR) call Number() of function.

i.e

/process_data/ResultsXML/approvers/approver[Number(/process_data/@Appr over_index)]/CommonName

I feel this must be a bug in Adobe LiveCycle.

Nith

Avatar

Former Community Member

Splitting things up in more variables / actions also works.

You concat alot of things all at once.

first make an action to get the first value, see if that works, then the second xpath action

then finally combine them with copy-paste just to make sure you don't make typoe's

Another thing you must know but certainly do: when using numbers ALWAYS surround your XPATH with the Number() action. Your counter must be surrounded by Number(). Off course only the part which is a Number but I guess you would have figured that out yourself. (This is the same as +0 does as the compiler will know it can only increment numbers by another number)

Avatar

Level 3

the +0 trick worked perfect.  arg.

That's good to know about the number() function too as it opens my mind up a bit on the subject.  I don't come from a traditional developer background so I have to wade through a lot of these landmines.

Thanks all.