cancel
Showing results for 
Search instead for 
Did you mean: 

How to read nested segments in loop to calculate discount

Former Member
0 Kudos

Dear Friends,

I need your help to light on the following issue, I need to loop nested elements in message mapping for calculation, some records i have to ignore, some i have to conside in loop, appreciate your immediate help to get me out of this problem.

Source Message Structure:

Source Message Message Type

NODES OCCURANCES

ST

G_S0300 -> 1..9999

S_G68 1..1

S_G69 0..5

S_G70 0..2

S_S0310 0..100

S_G72

D_340(element)

D_331(element)

D_359(element)

sample data

-


-


Data node occurance 1

<G_S0300>

- <S_G68>

<D_330>15</D_330>

<D_355>CA</D_355>

<D_237>142.08</D_237>

<D_438>001708202669</D_438>

<D_235>IT</D_235>

<D_234>642140</D_234>

- <S_G69>

<D_369>FS JACK LINK 1 OZ MIXED BEEF S</D_369>

</S_G69>

- <S_G70>

<D_356>192</D_356>

</S_G70>

- <G_S0310>

- <S_G72>

<D_340>5</D_340>

<D_331>02</D_331>

<D_359>-15.79</D_359>

</S_G72>

</G_S0310>

</S_G68>

</G_S0300>

-


Data node occurance 2----


<G_S0300>

- <S_G68>

<D_330>43</D_330>

<D_355>CA</D_355>

<D_237>71.04</D_237>

<D_438>001708202619</D_438>

<D_235>IT</D_235>

<D_234>649103</D_234>

- <S_G69>

<D_369>FS 96 CT BEEF STICK</D_369>

</S_G69>

- <S_G70>

<D_356>96</D_356>

</S_G70>

- <G_S0310>

- <S_G72>

<D_340>95</D_340>

<D_331>02</D_331>

<D_332>1</D_332>

<D_828>71.04</D_828>

</S_G72>

</G_S0310>

- <G_S0310>

- <S_G72>

<D_340>5</D_340>

<D_331>02</D_331>

<D_359>-7.9</D_359>

</S_G72>

</G_S0310>

</S_G68>

</G_S0300>

-


Data node occurance 3

- <G_S0300>

- <S_G68>

<D_330>32</D_330>

<D_355>CA</D_355>

<D_237>50.4</D_237>

<D_438>001708202577</D_438>

<D_235>IT</D_235>

<D_234>998856</D_234>

- <S_G69>

<D_369>JACK LINKS ORIGINAL BEEF STICK</D_369>

</S_G69>

- <S_G70>

<D_356>144</D_356>

</S_G70>

-

<G_S0310>

- <S_G72>

<D_340>95</D_340>

<D_331>02</D_331>

<D_332>1</D_332>

<D_828>50.4</D_828>

</S_G72>

</G_S0310>

</S_G68>

</G_S0300>

I need to loop through G_S0310 SEGMENTS TO CALCULATE NET PRICE BASED ON <D_340>, <D_331> VALUES.

aS <G_S0310> can occur multiple times, and also s_g72 can occur multiple tiles

In sample Data node occurance 2,

I should not take <G_S0310>

- <S_G72>

<D_340>95</D_340>

<D_331>02</D_331>

<D_332>1</D_332>

<D_828>71.04</D_828>

</S_G72>

</G_S0310> for net price calculation

but i have to take <G_S0310>

- <S_G72>

<D_340>5</D_340>

<D_331>02</D_331>

<D_359>-7.9</D_359>

</S_G72>

</G_S0310>

in similar way in data node occurance 1, I have to take the following node ( for D_340>5</D_340> <D_331>02</D_331>)

<G_S0310>

- <S_G72>

<D_340>5</D_340>

<D_331>02</D_331>

<D_359>-15.79</D_359>

</S_G72>

</G_S0310>

in sample data occurance 3

I should take the below combination for net price calculate , but I have pass <S_G68>-->D_237 to target node with out calculation

<S_G72>

<D_340>95</D_340>

<D_331>02</D_331>

<D_332>1</D_332>

<D_828>50.4</D_828>

</S_G72>

Thanks.

John

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Dear Friends,

I need your help to know whether I can read below segment S_S0310 in loop in Java UDF or need to write a java mapping program if there is any help greatly appreciated

Source Message Message Type Target

NODES OCCURANCES Node

ST

G_S0300 -> 1..9999

S_G68 1..1

S_G69 0..5

S_G70 0..2

S_S0310 0..100

S_G72 0..1

D_340(element) calculate

D_331(element) -


> NetPrice

D_359(element)

Thanks In Advance.

John.