05 lor connectors work

© 2019 - State of Utah - Department of Technology Services
Jump to navigation Jump to search

How “And” “Or” and “LOr” Connectors Work

The “AND” and “OR” connectors can be tricky. The “AND’s” are linked together, like a series of pipe welds as a pipeline tries to connect to a customer. If the new water-works customer is located across the alley from the water company, they could stretch a pipe all around the block to reach him, or they could run the line straight under the alley. It is easy for And/Or combinations to be misinterpreted. For instance, if you were to look for a worksite or composite worksite with at least 200 employees, the statements –

AMEc > 200

AND MEEIc = ‘3’

OR MEEIc = ‘5’

may appear to say “If AME > 200 and the MEEI is either ‘3’ or ‘5’”, but this is false. It actually says, “If AME > 200 and the MEEI is ‘3’, then select it; or if the MEEI is ‘5’ (regardless of the AME), select that too.” To have the AME condition apply to both MEEI values, either repeat the AME check before the MEEI = ‘5’ comparison, or use a values list (i.e., MEEIc = ‘3,5’), to make it a two-line parameter set. This would be shown on the parameter screen as –

AME C > 200

AND MEEI C = 3,5

and is translated as “If AMEC > 200 And MEEIC = (‘3’ or ‘5’)”.


The linked-Or (or “LOR”) makes things even more confusing. The diagram displayed below helps to demonstrate how these work. It shows three separate paths that allow crossing from one side of the “river” to the other. The one in the center (bridge “B”) is the simplest. It only checks one condition. In essence, it says, “If B holds your weight, then you may cross.” In other words, “If B is true, select the record.”


Es2n - job 040d - and or lor bridge.png


The “A” line is more complex, since it has four inter-connected sections (labeled ‘A1’, ‘A2’, ‘A3’, and ‘A4’). This is equivalent to four conditions that are connected by “AND” conditions. In order to cross the river on this path, all four of the bridge sections must hold; or all four of the conditions must test “true” to select the record. If any one of these conditions is false, then the record cannot be selected (i.e., you can’t cross the river on that bridge).


The “C” line is even more convoluted. It demonstrates how the “LOR” connector works. On either “bank” of the river is a bridge section/test condition, namely “C1” and “C3”. But the path branches into three avenues in the center, namely “C2a”, “C2b”, and “C2c”. In this case, the C1 and C3 conditions must test positive, but only one of the C2 tests must be true. Mathematically, the center conditions can be considered a combination of “OR” conditions tied together with a set of parentheses. C1 and C3 and connected by “AND” conditions. So a record can be selected along the “C” line via – “If C1 is true AND (C2a is true OR C2b is true OR C2c is true) AND C3 is true.” Using the bridge segment analogy, “If you can walk on C1, and you can get by the middle of the stream on one of the three C2 segments, and the C3 section is solid, then you may cross on the C bridge.”


Each of the three “bridges” is separated from the others by an “OR” statement. Each segment getting you farther across the river is linked by an “AND” connector, and each branch in the middle is connected with the “LOR” identifier. All of the options for selecting a record could be expressed relative to the symbols shown on the diagram with a statement such as –

“IF ‘A1’ AND ‘A2’ AND ‘A3’ AND ‘A4’ OR ‘B’ OR ‘C1’ AND ‘C2a’ LOR ‘C2b’ LOR ‘C2c’ AND ‘C3’, THEN select the record.”


Yet, with all of the “AND”, “OR”, and “LOR” connectors, this still looks terribly muddled. To make it more readable, we can add parentheses to show separators of “OR” conditions, and the inner parentheses of “LOR” connectors that convert them to more familiar “OR” statements. Then the whole thing becomes –

“IF (‘A1’ AND ‘A2’ AND ‘A3’ AND ‘A4’) OR ‘B’ OR (‘C1’ AND (‘C2a’ OR ‘C2b’ OR ‘C2c’) AND ‘C3’), THEN select the record.”


There are plenty of examples of linked-or assessments. One person may define a great work day as a Friday in the springtime when either they are given the afternoon off, they receive a raise, or they complete a major project. That could be expressed with these connectors as –

IF day-of-the-week = Friday

AND April ≤ Month ≤ June

AND (Work-hours < 5 OR Pay-Raise = ‘Yes’ OR Big-Project = Done)

Then ‘It’s a great work day’”


We should mention the conventions available for data entry in the screen fields. When typing in the “AND/OR/LOR” field, you can type in just an “A”, “O”, or “L”. The comparison code can be entered either with the letter codes (“EQ”, “GT”, etc.,) or the symbolic codes (“=”, “>”, etc.). Whichever method is selected will remain on the screen. Again, keep in mind that the value range and the value list options can only use the equal or not-equal comparison codes. Quarter-specific values can be identified either by the quarter number (‘1’ for future, ‘2’ for current, ‘3’ for prior, etc.), or by quarter letter code (‘F’ for future, ‘C’ for current, ‘P’ for prior). These were used interchangeably within the sample.


Related Links