xlate "IF" help

  • Creator
    Topic
  • #52317
    Tom Arrowsmith
    Participant

    I am trying to specify a number of values in an “IF” statement – many of which include the forward slash character (/).

    Here’s the entry I have:

    1(0).PRA(0).#3(0).[0] eq=Deceased || 1(0).PRA(0).#3(0).[0] eq=Duplicate Provider || 1(0).PRA(0).#3(0).[0] eq=Inactive ||  1(0).PRA(0).#3(0).[0] eq=Inactive/AHP || 1(0).PRA(0).#3(0).[0] eq=Inactive/Resident || 1(0).PRA(0).#3(0).[0] eq=Inactive/Student ||  1(0).PRA(0).#3(0).[0] eq=Unknown

    This errors out…

    I can get it to work if I put all the ones with spaces or the forward slash in a variable and then refer to that variable… but that’s kind of tedious. Is there another way?

    Also, do I have to have so many “OR”s? (||) ? or is there another way to do this in an xlate?

    Thanks!

Viewing 1 reply thread
  • Author
    Replies
    • #73775
      Jim Kosloskey
      Participant

      Tom,

      One way to solve both issues is to put the values you ar checking for in a Lookup Table.

      Each value then woudl be associated with a ‘true’ value (like Y) and the default a ‘false’ value (like N).

      The in the Xlate do a lookup of the 1(0).PRA(0).#3(0).[0] filed against the Table putting the result to a temp variable.

      Then one If seeing if the temp variable from the lookup us ‘true’ (like a Y) will tell you if the 1(0).PRA(0).#3(0).[0] contained any of the literals in the Lookup Table.

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

    • #73776
      Ryan Spires
      Participant

      I would prefer to do as Jim suggested…. a lookup table…

      However, if you want a simple list (one that would require mod of code to maintain)

      Then you could do something like:

      tcl>set praList

        Deceased {Duplicate Provider} Inactive Inactive/AHP Inactive/Resident Inactive/Student Unknown

        tcl>lsearch $praList $data

        This will return a -1 if no value found or the index of where it is found in the list.

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

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,432
Topic Tags
286
Empty Topic Tags
10