cancel
Showing results for 
Search instead for 
Did you mean: 

UDF or Mapping for removing more items

Former Member
0 Kudos

Hi

I'm in a need to implement a data validation using UDF or Graphical Mapping

File has the data like ONE header record (5 fileds) and ONE item record (8 fields) as follows

header:field1field2 field3 field4 field5

item:field1field2 field3 field4 field5 field6 field7 field8

header:field1field2 field3 field4 field5

item:field1field2 field3 field4 field5 field6 field7 field8

header:field1field2 field3 field4 field5

item:field1field2 field3 field4 field5 field6 field7 field8

and so on.

Here my requirement is one header should have only one item. Sometimes either header or items are repeating more than one time .. in that case lastest header or item should be updated in target fields.

To say clearly ... one header and one item & one header and one item and so on to be updated.

In case any header has two items then first item to be deleted and second item to be updated.

Kindly advise me how to go about this requirement.

Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Create the UDF of type context by using below code

int l=a.length-1;

result.addValue(a[l]);

Here a is the input parameter.

And map the fields like header>UDF> header (target side) like item and all the fields map.

Regards

Ramesh

Former Member
0 Kudos

Do the mapping as


Direct assignment of Source header to Target Header and same for fields inside the Header.

create a UDF (choose context).very simple UDF with a single statement.


result.addValue(a[a.length-1]);
 

Item Node mapping and Its Fields


Item------>UDF------>Item(Target)
field1(Change the context to Header)------->UDF----->field1(under Target Item)
Do the same mapping for remaining fields Under Item as you  do for field1

I have tested the above UDF and the mapping..It is working according to your requirement.