Skip to Content

Issue Statement: If there are duplicate records(identified by key field) in a message, send only one record to target system.

Input & Output Message Structure:

MT_Vendor

     row

          SupplierNumber

          Field1

          Field2

          ….

          ….

Logic: Create ‘row’ node only once for duplicate records. Suppress the other duplicate records.

Solution: Create a simple UDF, to suppress the subsequent duplicate records. I got the UDF code from SDN, when I was implementing the logic for a project 🙂

Message mapping:

Duplicate_Mapping.png

UDF_Signature.png

UDF Code:

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

    int found = 0;

    for (int j = 0; j < i; j++) {

       if (input[i].equals(input[j]))

{

          found = 1;

          break;

      }

    }

    if (found > 0) result.addSuppress();

    else result.addValue(input[i]);

}

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply