cancel
Showing results for 
Search instead for 
Did you mean: 

How to populate 2 target field with same input Value

Former Member
0 Kudos

Hi Experts,

How to generate 2 different node from the single value coming from sender side.

Suppose 10 is coming from sender, we will do some calculation and suppose we get value as 4,so this 4 will be used as input for first target field and for second target field input value will be 10-value passed to 1st target field.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I have already wrote the code to generate the 10 record with all the fields.

maheswarareddykonda
Active Contributor
0 Kudos

Abhinav,

Source fields you can re use number of times if you want in Graphical mapping.  suppose

field1---> target1

field1---> target2

if suppose you are doing calculations and mapped to target field and same thing you want for some other also then just do right click and copy before target filed(i mean after all caluculations) and then goto another target field again right click and select insert , you will get all condition and map to target2.

Former Member
0 Kudos

No Mahesh,

There are total 10 record will be get generated,First 4 record will carry the first field value and second field will be empty at that point next 6 record will carry the second field value and first field value will be empty in those 6  records.

Former Member
0 Kudos

Hi,

Please check the context of your Source field. Make sure that you say when it needs to be used. It seems the context is set to run for each input.

Right click on the source field and send me a screenshot of the context available?

Regards,

Jannus Botha

Former Member
0 Kudos

Mapping Structure.

Output should be like this.

Till the last record.

maheswarareddykonda
Active Contributor
0 Kudos

try this out, and do small changes if required as per ur requirement

String field = "";

for(int i=0;i<var1.length;i++)

{

field = var1[i];

if( i<4)

{

result.addValue(field);

}

else

{

result2.addValue(field);

}

}

maheswarareddykonda
Active Contributor
0 Kudos

HI Abhinav,

is this issue resolved?

please check this code.

Former Member
0 Kudos

This is no problem with graphical mapping:

Just connect the 10-field once with your calculation and additionally with your secong target field.

PI will treat them separatly and do something like this:

target1 = calculate( 10-field )

target2 = 10-field

Former Member
0 Kudos

No Hieko,

First 4 record will carrying the ouput of first field and second field will be empty at that moment.After 4 record second field will carry the value and First field will be empty.

I have to generate 10 record which will have both the fields.

Former Member
0 Kudos

Could you post an example how your input and expected output looks like?

I asume, that your calculation only returns 4 values instead of ten. So you would have two queues with different lengths. If this is the case, you got to make sure, that the calculation always returns 10 values - at least with dummies or suppress.

Former Member
0 Kudos

Suppose above fig is my Mapping Structure.

Output should be something like this below figure.

Like this till the last record.