cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with a UDF in Mapping

Former Member
0 Kudos

I have the following requirement.

At the source side i have:

Employee 1..n Employee 1..n

Type 1..1 A

Name 1..1 abc

Id 1..1 123

If my Type is 'A' then i should get the following output else these fields should be blank

At the target side i have

Employee Employee

Details 1..n Details

Data abc

Details

123

Its something like the node 'Details' should repeat twice with the elements under it if the Type is 'A'.

I have tried using a UDF but 'Details' is repeating as a field and not as a node with 'Data' under it.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I think it would be easier to do it this way.

Go to the mapping editor and right-click on the Details node, then select "Duplicate Subtree".

You should now have two Details nodes.

Then use an "if-without-else" statement to map the second Details node, where you condition would be "if Type equals A".

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Jayalaxmi,

Can you post ur source structure and input file data here.In UDF, u should have two for 'for' loops and according to ur requirement u should change the logic.

reply back with source , target str and iput file data.

Regards,

srinivas

Former Member
0 Kudos

Hi Jayalaxmi,

Assume you are creating the 'Data' elements from the UDF, if the employee type is 'A'.

While creating the 'Data' elements, try using the SplitByValue[Eachvalue] node function.This would create a separate Detail node for the 'Data' elements.

Thanks,

Anand