Multi values in IF statement

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Multi values in IF statement

  • Creator
    Topic
  • #48054
    Mark Rilling
    Participant

    Hello,

    I am trying to look at multipule values with an IF statement…For example I have 100 OBX segments and I only want to copy ones with certain values.  I have it working for just 1 value.  can I add more to a single IF statement:

    0(0).OBX(%s1).00571.[%s1] eq =xxx

    Is it possible to have it look for xxx AND yyy or do I need seperate IF statements?

Viewing 3 reply threads
  • Author
    Replies
    • #57471
      James Cobane
      Participant

      Mark,

      You can check for multiple values within the same IF; you just need to repeat the condition (separated by logical OR – the pipe symbols || ) with the new comparison value:

      (0(0).OBX(%s1).00571.[%s1] eq =xxx) || (0(0).OBX(%s1).00571.[%s1] eq =yyy)

      I’d also recommend parenthesizing the conditions.

      Hope this helps.

      Jim Cobane

      Henry Ford Health

    • #57472
      Mark Rilling
      Participant

      I’ll give it a try

      Thank you!

    • #57473
      Mark Rilling
      Participant

      THX again for the help.  The ( ) seemed to be required, as it did not work w/o them.    Any suggestions on the best way to block unpopulated OBX segments (no value in field 5) and re-number the remaining OBX so they are sequencial?

    • #57474
      James Cobane
      Participant

      Mark,

      You can use a different iteration variable on the ouput field (i.e. %s2) and increment that only when you actually perform a copy based on OBX:5 being valued.  So, your COPY statement will look something like:

      COPY (0(0).OBX(%s1).00571.[0] –> (0(0).OBX(%s2).00571.[0]

      (not sure of the actual field numbers, but same concept)

      And you’ll perform a MATH operation after your copy statement, with the following input values:

      $%s2

      =1

      and the output value will be:  $%s2

      You can reference/manipulate the actual value of the iteration variable by preceding it with the $ sign.  So, you’re using a new iteration variable (%s2) on the output side which is only being incremented when the condition (OBX:5 != @null) is true.  Hope this makes sense.

      Jim Cobane

      Henry Ford Health

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

Forum Statistics

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