cancel
Showing results for 
Search instead for 
Did you mean: 

graphical map query

former_member183906
Active Contributor
0 Kudos

hi,

i m using PI 7.31 and have a graphical map query.

In the INPUT file i am getting a field INP1 which will have dynamic value like - 1,2,3,4,5,6,7,8,9 or 10 or any number.

In the OUTPUT file depending on INP1 value OUT node needs to be created and OUT value should be OUT_1,OUT_2 etc.

Example-

(1) Input - INP1=2

Output should be ,since input value is 2, 2times OUT node should come 2 times with values - OUT_1 and OUT_2

(2) Input - INP1=4

Output -OUT node should come 4 times with values - OUT_1,OUT_2,OUT_3,OUT_4

if UDF is needed for it also ,please advise.

regards

Accepted Solutions (0)

Answers (4)

Answers (4)

Muniyappan
Active Contributor
0 Kudos

Hi,

Did you get this worked out?

can you please pass your input and output xml if possible?

Regards,

Muniyappan.

Muniyappan
Active Contributor
0 Kudos

Hi,

Check this.

if it is not your requirement please share your input and output xml file.

Regards,

Muniyappan.

Former Member
0 Kudos

Hi,

you need to explain the source and target structure again. can you paste the schema here?

I understood like below

source structure

A

B

then the count of the above context is 2 hence you need to generate two target nodes then use the below UDF

int count = 0;               

               int j =0;

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

               {j++;

               

                  if(j == Integer.parseInt(arr2[count])&& i <arr1.length-1)

                       {

                               result.addValue(arr1[i]);


                               result.addContextChange();                               

                               count++;

                               j =0;

                       }

               

                       else

                       {

                               result.addValue(arr1[i]);

                       }

                       

               }

Cheers,

Hidayat

former_member184720
Active Contributor
0 Kudos