Rank: Newbie
Joined: 10/14/2020 Posts: 4
|
I have been stumped by this problem and I am hoping someone on this forum may be able to help me out.
As a dynamic table is looping, I need to output a value based on the previous loop's element's value. I need to see if a element's value has changed from the previous loop, and if it has, output the difference between the current value and the previous value.
For example, using the following XML:
<FST type="Segment"> <FST01>22</FST01> </FST> <FST type="Segment"> <FST01>22</FST01> </FST> <FST type="Segment"> <FST01>22</FST01> </FST> <FST type="Segment"> <FST01>66</FST01> </FST> <FST type="Segment"> <FST01>66</FST01> </FST>
I need to output the column values as follows:
FST01 22 0 0 44 0
Any help would be greatly appreciated. Thank you in advance.
|
Rank: Newbie
Joined: 10/14/2020 Posts: 4
|
Hopes this helps others. Here is an example of the working code:
if (number(./preceding-sibling::n1:FST[1]/n1:FST01) = (./preceding-sibling::n1:FST[1]/n1:FST01)) then if ((n1:FST01) - (./preceding-sibling::n1:FST[1]/n1:FST01) > 0) then (n1:FST01) - (./preceding-sibling::n1:FST[1]/n1:FST01) else '' else n1:FST01
|