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.  Join field on a partial string match

    Employee
    Posted 10-15-2014 06:27

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

    Originally posted by: Varsha.Pindola

    Hello

    Please can you help this the below scenario

    Dataset 1:
    Column Name 1
    To
    An

    Dataset 2:
    Column Name 2
    Tom
    Anna
    Dina

    Want a join/strFind to result in a match as follow:
    To to Tom
    An to Anna

    Used StrFind(column name 2, column name 1) this doesn't produce the result required.

    Kind regards
    Varsha


  • 2.  RE: Join field on a partial string match

    Employee
    Posted 10-15-2014 07:11

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

    Originally posted by: andycooper

    Hi Varsha,

    Depending on what you want to do with the data, you could use the left operator to match your values. If you are using an X-Ref node for example then use the following in the input key fields: -

    insert_column_name.left(2)

    Give this a try and see if that gives you the results you require. The StrFind operator will give you a numeric value representing the position in the field if the text is found (starting at 0). Typically if you want to select a value then you need an additional statement in the BRAINScript to identify where the StrFind result is greater than -1.

    Thanks

    Andy


  • 3.  RE: Join field on a partial string match

    Employee
    Posted 02-01-2015 23:25

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

    Originally posted by: Gordon Docherty

    Andy,
    the assumption here is that the desired text is 2 characters at the start of the second string.

    if working with the following,
    Data 1
    Col1
    1
    2
    3
    4
    5

    Data 2
    01
    20
    123
    4
    6

    what method is recomended?

    rgds Gordon


  • 4.  RE: Join field on a partial string match

    Employee
    Posted 02-02-2015 02:19

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

    Originally posted by: andycooper

    Originally posted by: Gordon Docherty
    					

    Andy,
    the assumption here is that the desired text is 2 characters at the start of the second string.

    if working with the following,
    Data 1
    Col1
    1
    2
    3
    4
    5

    Data 2
    01
    20
    123
    4
    6

    what method is recomended?

    rgds Gordon
    For some reason, Gordon's post does not appear on the thread!

    Anyway, in the scenario he describes, I would suggest that you first use a data analyser node to evaluate the length of each field (I suggest you also turn off data conversion as we want the data fields to be string intially). Using the pad command we can then set all values to the same length before joining the data. This can be done in the X-Ref node or in a seperate filter node. Please find an example below of both options: -

    Pad Data.brg