cancel
Showing results for 
Search instead for 
Did you mean: 

ResultList object usage

Former Member
0 Kudos
341

Hello

I am having a scenario where my source structure is having occurences 0..9999 and my target structure is having occurence as 1.

e.g. my source structure looks like

<E1MLGNM SEGMENT="1">

<MSGFN>005</MSGFN>

<LGNUM>510</LGNUM>

<LHMG1>0.000</LHMG1>

<LHMG2>0.000</LHMG2>

<LHMG3>0.000</LHMG3>

<MKAPV>0.000</MKAPV>

<LGBKZ>015</LGBKZ>

<VOMEM>N</VOMEM>

</E1MLGNM>

<E1MLGNM SEGMENT="1">

<MSGFN>005</MSGFN>

<LGNUM>530</LGNUM>

<LHMG1>0.000</LHMG1>

<LHMG2>0.000</LHMG2>

<LHMG3>0.000</LHMG3>

<MKAPV>0.000</MKAPV>

<VOMEM>N</VOMEM>

<LGBKZ>011</LGBKZ>

I want my target field to contain value 011.For that I had done many conditions in the map and finally I am getting [ ] and [11] in the queue.I want to fetch value 11 from the array and map to my target structure.

Can resultlist object be used to have only one value? I tried to use result.addValue and result.addSuppress functions but they also give result [] and [11] in the display queue and hence i m getting blank in the target structure.

Thanks in advance.

Regards

Rajeev

Accepted Solutions (1)

Accepted Solutions (1)

former_member185751
Contributor
0 Kudos

Hi Rajeev,

Create an advanced user-defined function which accepts 1 parameter and write the following in it:

for(int i=0;i<a.length;i++){
if(a<i>!=null && !(a<i>.trim().equals(""))){
result.addValue(a<i>.trim());
}

Important: Read all "a" as "a of i" except in "a.length"

Though i have enclosed my code in code tags it automatically removes the square braces all with the contents

Map as follows:

Source node->adv.JavaFn->target node.

Let me know how it goes.

Regards,

Sridhar

Message was edited by: Sridhar Rajan Natarajan

Former Member
0 Kudos

Sridhar,

Thanks for the reply.Actually I tried that method yesterday only but it also returns 2 values when I see in the Display Queue of Java function.I tried to use result.clear() function but its of no use.Still it populates 2 values [] and [11] and it assigns the top value to the target node.

Just to clear one doubt if there are multiple values in source(here there r 2 values) and we have Java function in between, Java function gets invoked multiple times (in this case Java function should get executed twice )right?

Regards

Rajeev

former_member185751
Contributor
0 Kudos

Hi Rajeev,

Try to map as follows :

sourcenode>removecontext>adv.javafn-->targetnode

Let me know

Regards,

Sridhar

Former Member
0 Kudos

Sridhar,

Thanks a lot for that.It solved that problem.

Regards

Rajeev

Answers (0)