xlate wild card?

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf xlate wild card?

  • Creator
    Topic
  • #48037
    Nora Katz
    Participant

      In an xlate, is there a way to use a wild card?

      Currently, I have the following condition:

      IF1(0).PV1.00133[0] eq =FAIR

      I want to be able to apply the condition to include  =FAIR2, =FAIR3, =FAIR4, =FAIR5 also

    Viewing 3 reply threads
    • Author
      Replies
      • #57420
        Keith McLeod
        Participant

          You may be better served by using something like using a pre tcl upoc on you r copy command:

                set fairlist {FAIR FAIR1 FAIR2 FAIR3}

                set xlateOutVals [lcontains $fairlist $xlateInVals]

          This returns a 1 if contained in your list and 0 if not.

          COPY 1(0).PV1.00133[0] –> @flag

          IF @flag eq ==1 Then

          Hope this helps….

        • #57421
          Anonymous
          Participant

            If you don’t want to create a list of possible input values you could write the TCL snippet on a copy command….

               

          • #57422
            Jim Kosloskey
            Participant

              Nora,

              If the list is finite, another option is to use a Table Lookup.

              Populate the Table with the valid values. Each Valid value returns a “Y” and the default (notfound) returns an “N”. Have the Table Lookup populate a temp variable, then test the temp variable for Y or N and react accordingly.

              If you need to use Tcl, rather than write a snippet which can only be used once, why not write an Xlate proc which is driven by argument(s) and does a string match wherin the components of the string match command are built from the argument(s). The arguments can be passed at the invocation of the proc or (I do this a lot) place the argument(s) in temp variable(s) and include them in the Action which invokes the proc. The proc then searches for the argument(s) in the xltInList and gets the argument(s) value from the corresponding xlateInVals.

              This proc then can be used to look for any string matches in any Xlate related to any field or set of fields. Write it once use it many times.

              Jim Kosloskey

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

            • #57423
              Nora Katz
              Participant

                Thank you for all the responses!  I think Karl’s solution fits my situation the best.  

                Thanks again.

            Viewing 3 reply threads
            • The forum ‘Cloverleaf’ is closed to new topics and replies.