cancel
Showing results for 
Search instead for 
Did you mean: 

Accumulating all source field values for target field in XSLT

Former Member
0 Kudos

Hi Folks,

I have requirement that the Source Idoc is having a segment E1EDPU1 occuring multiple times. And the child segments E1EDPU5 & E1EDP02 of E1EDPU1 are occuring multiple times.

Am able to make the target segment tagged to E1EDPU1 to occur multiple times. But the values of E1EDPU5 & E1EDP02 segments are accumulating at the target fields.

Am providing the screenshots for better clarity

<InstNetAmt>

                                                                 <xsl:value-of select="./E1IDPU5[4]/MOABETR"/>

                                                                      </InstNetAmt>

Thanks in advance

Balu

Accepted Solutions (1)

Accepted Solutions (1)

ambrish_mishra
Active Contributor
0 Kudos

Hi Sekhar,

Do you want to add the values in the target field ?

Ambrish

Former Member
0 Kudos

Hi Mishra,

I need the value of one segment itself where in the screenshot E1EDPU5 006 segment having the value.

I have used the condition still it is taking all the values

<xsl:choose>

                                                                      <xsl:when test="./E1IDPU1/E1IDPU5/MOAQUAL = '006'">

                                                                                <InstNetAmt>

                                                                                          <xsl:value-of select="./E1IDPU1/E1DPU5/MOABETR"/>

                                                                                </InstNetAmt>

                                                                      </xsl:when>

                                                            </xsl:choose>

Could you please guide me on this

thanks

Balu

Former Member
0 Kudos

Hi Sekhar,

In that case, you don't actually need the <choose> and <when> at all. Just use this:

<xsl:value-of select="./E1IDPU1/E1IDPU5[MOAQUAL='006']/MOABETR"/>

inside the InstNetAmt element.

This will use the segment field MOAQUAL to select the correct segment.

Hope it helps.

Nick

ambrish_mishra
Active Contributor
0 Kudos

Hi,

I think what Nick suggested should work. If it doesn not, please revert back.

Ambrish

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sekhar,

Could you possibly post the <for-each> statement you have above the statement in the screenshot? It looks like you have an incorrect xpath which is selecting all 4 MOABETR elements and dropping the text into InstNetAmt. It should be an easy fix.

One question though: Do you want all 4 of these elements to be added together and the result put into InstNetAmt? Or do you want only the value from the 4th index of MOABETR?

Former Member
0 Kudos

Hi Nick,

I have checked the Xpath, it is fine.

No i don't need the sum of all values.

i have tried by using index it is working fine but in real time these segments might vary all the time.

so it should be generic.

Thank U

Balu