Problem with IF statement

Homepage Clovertech Forums Cloverleaf Problem with IF statement

  • Creator
    Topic
  • #119643
    Rich
    Participant

    No messages are crossing with this IF statement:

    2(0).3(0).0(0).AIL(0).#3(0).[0] ne @Clin_Screen || ~2(0).3(0).0(0).AIL(0).#3(0).[0] ne @Clin_us

    If I cut out the || and just make it 2(0).3(0).0(0).AIL(0).#3(0).[0] ne @Clin_Screen

    it works just fine.  I’ve used OR like this in other scripts, so I don’t understand what’s going on here.

    See attachment for full Xlate.

    Thank you all in advance!

    Attachments:
    You must be logged in to view attached files.
Viewing 4 reply threads
  • Author
    Replies
    • #119645
      Charlie Bursell
      Participant

      Have you output anything to ~2(0).3(0).0(0).AIL(0).#3(0).[0] at this point?

      A problem for Jim K. 🙂

    • #119648
      Tim Pancost
      Participant

      Looks like a logic issue.  What you’ve created here is a logical tautology.  That is, a statement that is always true.  Let’s say the value in AIL-3 is “CLINIC SCREENING”.  So your statement is saying if AIL-3 not “CLINIC SCREENING”(false) OR AIL-3 is not “CLINIC ULTRASOUND”(true), then do something.  A F/T OR statement is true, so it’s going to go into the IF body.  If AIL-3 is “CLINIC ULTRASOUND”, same thing just in reverse, a T/F OR statement is true.  And if AIL-3 is “CLINIC WHATCHAMACALLIT”, you have a T/T OR statement, which is, of course, true.  So the only way that this statement is false, is if AIL-3 is BOTH NOT “CLINIC ULTRASOUND” and NOT “CLINIC SCREENING”, which cannot happen.

      My guess is that you really want an AND(&&), not an OR(||).

      HTH,

      TIM

      Tim Pancost
      Trinity Health

    • #119654
      Paul Bishop
      Participant

      I agree with Tim – you need AND, not OR since you are dealing with not equal checks.  I know a lot of my co-workers will do a if else to avoid not equal checks.  If AIL-3 eq @Clin_Screen || AIL-3 eq @Clin_US, do nothing, else do something.

      Paul Bishop
      Carle Foundation Hospital
      Urbana, IL

    • #119656
      Rich
      Participant

      My goal here is to send only clinic screening, and clinic ultrasound, suppressing all other messages.

    • #119658
      Rich
      Participant

      Thank you all for your input, I truly appreciate it!  My final solution, after thinking it through, was to put the values in a table, and kill or send based on the values being present in the table.  This allows room for growth as well.

Viewing 4 reply threads
  • You must be logged in to reply to this topic.

Forum Statistics

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