cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Multiple Nodes ?

Former Member
0 Kudos

Hi Guys,

Request Structure - Node - occurs 0 - unbound

Target Structure - Node - occurs 0 - unbound

If there are 3 transactions coming from the reguest structure then i need to generate only 2 node structures on the target side.

can anybody explain me how can i acheive this, any help would be appreciated

Thanks,

Srini

Accepted Solutions (1)

Accepted Solutions (1)

justin_santhanam
Active Contributor
0 Kudos

Srini,

You mean if you get n messages from the source, then u need to create n-1 messages in the target is it?

or

You always need to create only 2 messages in the target , even if u get 10 messages in th source!

Could you plz tell us which one u r looking for?

raj.

Former Member
0 Kudos

Hi Raj,

If i get n messages, i need to create n-1 structures. I have used count and sub function and i need to check how it works.

plz let me know if you have any suggestions

Thanks,

Srini

Former Member
0 Kudos

Hi Srini !

Could you clarify which kind of logic you need to apply to obtain a n-1 output? which input record does not pass? are the target records the result of which kind of processing?

Regards,

Matias.

justin_santhanam
Active Contributor
0 Kudos

Srini,

The easiest way would be,

UDF- Advanced - Queue, one input


for(int i=0;i<a<i>.length-1;i++)
{
result.addValue("");
}

Node-->UDF--->Node

raj.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Raj,

I have acheived this with out UDF. I have used index function greater and a boolean function if then.

This index function counts the occurance of the node and if it is greater than 0 then only map to target.

Index function starts with 0 and increments by 1, so for the first occurance the value will be 0 and it is not greater than 0 and the first message will be skipped.

The logic is similar to UDF. Thanks for the suggestions

Thanks,

Srini

justin_santhanam
Active Contributor
0 Kudos

Srini,

So u did the following logic is it?

Node -


> index(0,1,Entire Document) & Constant(0)----->Greater-->CreateIf-->Node.

raj.

Former Member
0 Kudos

Hi Raj,

I have used If then instead of CreateIf. Remaining logic is same as you mentioned.

In the index function it is context instead of entire document

Thanks,

Srini

Edited by: srinivas kapu on Feb 13, 2008 3:51 PM

justin_santhanam
Active Contributor
0 Kudos

Srini,

Let's consider the below example.

Source

<Root>

<Nodes>

<Field1>100</Field1>

<Field2>100</Field2>

</Nodes>

<Nodes>

<Field1>200</Field1>

<Field2>200</Field2>

</Nodes>

<Nodes>

<Field1>300</Field1>

<Field2>300</Field2>

</Nodes>

</Root>

Consider My source and target are same, I used ur logic for Nodes to Nodes, and mapped Field1 to Field1 & Field2 to Field2

Now u will get the result as

Target

<Root>

<Nodes>

<Field1>200</Field1>

<Field2>200</Field2>

</Nodes>

<Nodes>

<Field1>300</Field1>

<Field2>300</Field2>

</Nodes>

</Root>

Is the above target is ur reqmt? It will suppress the first set of transactions from the source, are u ok with it?

raj.

Former Member
0 Kudos

Hi Srini !

Depending on the complexity of the structures, you should be able to solve this using conditional functions in graphical mapping or using an advanced UDF (user defined functions) that receives the queue with all input values (a string array) and inside you put your logic in java (all within the graphical mapping screen) to decide which data goes out and which not or generate the output based on the input.

Regards,.

Matias.

ps: please award points if helpful.