Question
· Jul 27, 2023

Rule logic

In an HL7 Business rule I am trying to block ONLY ORM messages that have a PV1:3.4 of 105 or 205 and a OBR:4 value of EP22 or CATH01.

I created the logic below but it appears to be evaluating the two fields independently instead of combined?

 

Here is what I had.

(((HL7.{MSH:SendingApplication.NamespaceID}="Epic_Cupid")&&(HL7.{ORCgrp(1).ORC:OrderControl} IN "NW,CA")))&&(((HL7.{PIDgrp.PV1grp.PV1:AssignedPatientLocation(1).Facility.NamespaceID} NotIn "105,205")&&(HL7.{ORCgrp(1).OBRuniongrp.OBRunion.OBR:UniversalServiceIdentifier.Identifier} NotIn "CATH01,EP22")))

I ended up getting it to work evaluating PV1:3.4 with OBR4.3: together using a single & instead of the AND (&&) operator. Trying to understand why it works this way.

((HL7.{PIDgrp.PV1grp.PV1:AssignedPatientLocation(1).Facility.NamespaceID} NotIn "105,205")&(HL7.{ORCgrp(1).OBRuniongrp.OBRunion.OBR:UniversalServiceIdentifier.Identifier} NotIn "CATH01,EP22"))&&(HL7.{ORCgrp(1).ORC:OrderControl} IN "NW,CA")

 

What is the difference between & and the AND operator in Rule Editor? 

Product version: IRIS 2021.1
$ZV: IRIS for UNIX (IBM AIX for System Power System-64) 2021.1.2 (Build 338U) Tue Apr 12 2022 12:08:46 EDT [Health:3.3.0]
Discussion (1)2
Log in or sign up to continue

Hi John the diference between the operators &, && are

https://docs.intersystems.com/iris20231/csp/docbook/DocBook.UI.Page.cls?KEY=GCOS_operators#GCOS_operators_logicalcomp_list

And (& or &&)

And tests whether both its operands have a truth value of TRUE (1). If both operands are TRUE (that is, have nonzero values when evaluated numerically), ObjectScript produces a value of TRUE (1). Otherwise, ObjectScript produces a value of FALSE (0).

There are two forms to And:

  • The & operator evaluates both operands and returns a value of FALSE (0) if either operand evaluates to a value of zero. Otherwise it returns a value of TRUE (1).
  • The && operator evaluates the left operand and returns a value of FALSE (0) if it evaluates to a value of zero. Only if the left operand is nonzero does the && operator then evaluate the right operand. It returns a value of FALSE (0) if the right operand evaluates to a value of zero. Otherwise it returns a value of TRUE (1).

The following examples evaluate two nonzero-valued operands as TRUE and produces a value of TRUE (1).

Try to eclousere all expression in parentehsis:

(
    (
        (
            (
                HL7.{MSH:SendingApplication.NamespaceID}="Epic_Cupid"
            ) 
            && 
            (
                HL7.{ORCgrp(1).ORC:OrderControl} IN "NW,CA"
            )
        )
    ) 
    &&
    (
        (
            (
                HL7.{PIDgrp.PV1grp.PV1:AssignedPatientLocation(1).Facility.NamespaceID} NotIn "105,205"
            )
            &&
            (
                HL7.{ORCgrp(1).OBRuniongrp.OBRunion.OBR:UniversalServiceIdentifier.Identifier} NotIn "CATH01,EP22"
            )
        )
    )
) 

The operator & in Business Rule e Editor is string concatenation operator. Take care.

https://docs.intersystems.com/iris20231/csp/docbook/DocBook.UI.Page.cls?KEY=EBUS_rule#EBUS_ruleset_editor_expression_operators