Use a substring to lookup table

Homepage Clovertech Forums Cloverleaf Use a substring to lookup table

  • Creator
    Topic
  • #117048
    Ryan Curtin
    Participant

    This might be an easy one but I’m trying to take a substring of a field, pass it to a lookup table and if that substring passes leave the field alone else perform some action on it. my issue is getting the first three characters of a field and then using that as the input to the lookup table.

    So if I have : AB1BT1550 i just want to use the AB1 in the lookup. and maintain the original value if it succeeds, I just wont know the full value ahead of time.

    Any assistance would be appreciated.

     

Viewing 1 reply thread
  • Author
    Replies
    • #117049
      Tipu Razaq
      Participant

      If used in an xlate assuming xlateInVals has the value of interest:

      set substr [string range [lindex $xlateInVals 0] 0 2]

       

      If in a TCL script:

      set substr [string range “AB1BT1550” 0 2]

    • #117050
      Jim Kosloskey
      Participant

      If I understand correctly:

      Use the STRING Action to get the first 3 characters of the IB field putting the result in a temp variable (say @1st3).

      Use the Temp Variable for the Table lookup.

      In the Table set the right side of each entry to ‘Y” (eliminate the quotes) and the default to ‘N’ (again eliminate the quotes).

      Do the Lookup and place the result in another temp variable (say @lu_result).

      Use an IF Action to check @lu_result eq =Y

      true COPY the original IB field to the Destination

      ELSE

      false COPY @1st3 to the Destination.

       

      The above is without using any Tcl.

      Obviously with Tcl the solution would look different.

       

      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.

Forum Statistics

Registered Users
5,127
Forums
28
Topics
9,300
Replies
34,445
Topic Tags
288
Empty Topic Tags
10