LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Lookup on different length strings

    Employee
    Posted 07-03-2014 00:45

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: sree

    Hi Team,
    I have source data like this

    Source
    -------
    100008
    100006
    100003
    0000999022
    00100000
    00100225

    And reference data like this

    Reference Data:
    ---------------
    Department ID Department Code

    0000100008 GPMA/RDW5/KGL
    0000100000 GPMA/RD02/KGL
    0000100225 CHMS/GB11/KGL
    0000999022 CHMS/GB12/KGL
    0000100003 GPMA/RD10/KGL
    0000100006 GPMA/RD42/KGL

    in source and reference data length are different ,but need to look up and populate Department Code to target fields.
    Please suggest how to do reference between between source data and reference data column.
    Thank you for all your supporting.

    Regards,
    Sree.


  • 2.  RE: Lookup on different length strings

    Employee
    Posted 07-03-2014 07:51

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ltolleson

    It seems the difference in your data is that the Department ID in the Reference Data has leading zero's. You need for both sets of data to be similar format before you can compare the sets.

    There are two ways that you can solve this issue.

    1) Add leading zeros's to the Source data using the pad() function. The pad() function will add characters to a string to make it the desired length. By default it will pad zero's to the left. The code would look like this.

    newSource = source.pad(10)

    emit newSource
    2) Convert both the Source and Reference data fields to long integers. This will remove all leading zeros from both sets of data. You can do this by either adding a filter node to each data stream and convert both Department ID fields to a long() OR you can simply apply the long() function to the field names when you use them as the key in your x-ref or lookup nodes.

    See attachment for example...

    Enjoy,
    Larry
    Attachments:
    CompareDeptID.brg