table lookup with OR

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf table lookup with OR

  • Creator
    Topic
  • #49582
    Duy Nguyen
    Participant

    My existing code checks the value of variable against a table and assigns engine disposition appropriately. i.e. KILL, CONTINUE

    I am needing to modify the code to check  2 variables right now.  As long as one of the variable values is found in the table, I want to have a CONTINUE disposition.

    Here is the old code…


     ## check value in the Physicians_ALLOW table

                 set disp CONTINUE

                 set disp [hcitbllookup Physicians_ALLOW $obr16]

                 if {![string length $disp]} {set disp KILL}

            echo THE DISPOSITION VALUE===== $disp


    Here is what I’m thinking for the new code


     ## check value in the Physicians_ALLOW table

                 set disp_obr16 CONTINUE

                 set disp_orc12 CONTINUE

                 set disp_obr16 [hcitbllookup Physicians_ALLOW $obr16]

                 set disp_orc12 [hcitbllookup Physicians_ALLOW $orc12]

                 if {![string length $disp_obr16]} {set disp KILL}

                 if {![string length $disp_orc12]} {set disp KILL}

            echo THE DISPOSITION VALUE===== $disp


    *Would the 2 last if statements eliminate the need for an OR syntax?

    **Is there an easier or more efficient way of doing this?

Viewing 5 reply threads
  • Author
    Replies
    • #62573
      garry r fisher
      Participant

      Hi,

      Why don’t you set the default value of the table to KILL so if the lookup fails it returns KILL into your dispList?

      Regards

      Garry

    • #62574
      Duy Nguyen
      Participant

      garry r fisher wrote:

      Hi,

      Why don’t you set the default value of the table to KILL so if the lookup fails it returns KILL into your dispList?

      Regards

      Garry

      It is currently set with a default value of ‘KILL’

    • #62575
      garry r fisher
      Participant

      Hi Duy,

      If you are already setting a default then if a value is found then CONTINUE is returned, if not KILL is.

      Are you saying that only one of your disp lists can be true at any time. i.e. both cannot be CONTINUE?

      Regards

      Garry

    • #62576
      Duy Nguyen
      Participant

      garry r fisher wrote:

      Hi Duy,

      If you are already setting a default then if a value is found then CONTINUE is returned, if not KILL is.

      Are you saying that only one of your disp lists can be true at any time. i.e. both cannot be CONTINUE?

      Regards

      Garry

      Garry,

      I’m basically using OR logic.  As long as 1 of the 2 values is found in the table, I want CONTINUE to be returned.  Thanks.

    • #62577
      Charlie Bursell
      Participant

      Set table default to 0, then

      if {!![hcitbllookup Physicians_ALLOW $obr16]  &&

                ![hcitbllookup Physicians_ALLOW $orc12]} {

          lappend dispList “KILL $mh”

      } else {

          lappend dispList “CONTINUE $mh”

      }

      return $dispList

    • #62578
      Duy Nguyen
      Participant

      Thanks, Charlie.  I will test that out. =)

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

Forum Statistics

Registered Users
5,126
Forums
28
Topics
9,296
Replies
34,439
Topic Tags
287
Empty Topic Tags
10