Skip to main content

Demonstration: Using the Expression Editor

Next we will add a when block to the rule and use the Expression Editor to configure its condition. Here are the steps:

  1. Click the rule 1 box and then click +. Select when from the drop-down list.

    generated description: addwhen 20152

  2. Next we use the Expression Editor to add a condition. Launch the Expression Editor by double clicking the condition box.

    generated description: addcondition 20141

  3. Click the function selector button generated description: littlefx 20141 and then select Contains from the drop-down list.

    generated description: expressioneditor1 20141

  4. Click the uppermost of the two boxes associated with the contains function. This puts the input focus in the upper text box. In this box we enter HL7.{MSH:ReceivingApplication}. The editor provides assist after you type the HL7.{. Use tabs and down arrows to select the right code. Be sure to place a closing curly brace at the end. Click the OK button immediately to the right of the text box.

    generated description: configurecontains1 20161

  5. Click the lowermost of the two boxes associated with the contains function. This puts the input focus in the upper text box. Enter "PHARMACY" — be sure to include the quotation marks. Click the OK button immediately to the right of the text box.

    generated description: configurecontains2 20161

  6. The fully configured condition looks like this.

    generated description: configurecontains2 5 20161

  7. Click OK in the lower right hand corner to close the Expression Editor and save your changes. The rule now looks like this.

    generated description: configurecontains3 20161

Note:

The HL7.{MSH:ReceivingApplication} entered above is an example of HL7 virtual property syntax. It is the syntax used by Ensemble code to retrieve information from the HL7 data contained in Ensemble messages. To learn more about virtual property syntax, read Virtual Property Path Basics.

The contains function used in the rule is case-sensitive. So, right now our condition is case-sensitive. A value of "pharmacy" in the MSH:ReceivingApplication field does not match our condition. We can fix this potential problem using the ToUpper function in our expression. Open the Expression Editor. Click the first (upper) argument to contains and then select ToUpper from the function list. Now the value is converted to upper case before it is used by contains.

FeedbackOpens in a new tab