cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping challenge !! Generate target for unique combination of source field

Former Member
0 Kudos

Hi,

I/P:

<Segement1>

<Article>1</Article>

</Segement1>

<Segement1>

<Article>2</Article>

</Segement1>

<Segement2>

<StoreNum>12</StoreNum>

<StoreNum>13</StoreNum>

<StoreNum>14</StoreNum>

</Segement2>

and the output should be like for every unique combination of Article and StoreNum I have to create a target node and the corresponding values in that node: (So in this case the o/p node will come 6 times)

<Detail>

<Article>1</Article>

<StoreNum>12</StoreNum>

</Detail>

<Detail>

<Article>1</Article>

<StoreNum>13</StoreNum>

</Detail>

.

.

.

.

.

<Detail>

<Article>2</Article>

<StoreNum>14</StoreNum>

</Detail>

Can anybody please suggest a solution ?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

though i am able to generate the target node as desired using the following UDF but facing the problem while populating unique set of values in the target node.

String a="";

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

{

for(int j=0;j<var2.length;j++)

{

a= var1 i (in square barckets)+var2[j];

result.addValue(a);

}

}

Edited by: jayagupta21 on May 14, 2011 9:36 AM

Former Member
0 Kudos

articleremovecontext-sortsplibyvalue(valuechange)-collapsecontext

-


UDF---details

storenumsort-splitbyvalue(valuechange)--collapsecontext

mapping of the elements inside details node can be achieved using UDF or standard function also.

UDF2


for(int i=0;i<var1.length;i++)
{
for(int j=0;j<var2.length;j++)
{
result.addValue(var1<i>);
result.addContextchange();
}
}

repeat the same mapping for Article(target filed) using udf2 as mentioned above for details...

UDF3:


for(int i=0;i<var1.length;i++)
{
for(int j=0;j<var2.length;j++)
{
result.addValue(var2<i>);
result.addContextchange();
}
}

repeat the same mapping for Storenum(target filed) using udf3 as mentioned above for details...

Note: check for syntax errors.....

Answers (0)