Written by

Question Jason Lewins · Oct 6

Data Transform - If OBX 5 contains text Abnormal Flag populates

Hi,

I am trying to include in my Data Transform, if OBX 5.1 (Observation Value) Contains certain text i.e. DETECTED then populate the Abnormal Flag field with a certain letter.

Sometimes the text can be uppercase, lowercase or a multiple of both.

Any help would be much appreciated.

Thanks

Jason

Product version: IRIS 2023.1

Comments

DC AI Bot · Oct 6 Bot

To implement data transformation where OBX 5.1 contains certain text (e.g., "DETECTED") and then sets the Abnormal Flag field accordingly while handling case sensitivity:

  1. Create a Custom Function: Consider creating a utility class function like SetAbnormalFlag() to check the ObservationValue (OBX 5) and set the flag based on a conditional logic. This can handle both uppercase and lowercase occurrences by normalizing the text using $ZCONVERT or equivalent functions with case-insensitive checks [1][2].

  2. Setup Data Transformation Logic:

    • Use a foreach loop on all the repeating OBX segments within the message structure.
    • Within the loop, retrieve the value from OBX 5 using GetValueAt.
    • Check if this value contains "DETECTED" (you can use $FIND or $ZCONVERT for case-insensitivity).
    • If detected, set the Abnormal Flag in OBX 8 using SetValueAt[1].
  3. Example Structure:

    Set segmentCount = source.GetValueAt("PIDgrpgrp(1).ORCgrp(1).OBXgrp(*)")
    For segmentIndex = 1:1:segmentCount {
        Set observationValue = source.GetValueAt("PIDgrpgrp(1).ORCgrp(1).OBXgrp("_segmentIndex_").OBX:5")
        If ($FIND($ZCONVERT(observationValue, "U"), "DETECTED")) {
            Do source.SetValueAt("ABNORMAL", "PIDgrpgrp(1).ORCgrp(1).OBXgrp("_segmentIndex_").OBX:8", "set")
        }
    }
    

This process ensures that the text comparison is conducted without being affected by its case, and the Abnormal Flag is appropriately set for each relevant OBX segment [1][2][3].

Let me know if additional assistance is needed!

Sources:

0
Jeffrey Drumm · Oct 6

Use a combination of the ToUpper() and Contains() methods in the Function list with an if rule:

The AI Bot offers another option, but it's probably a bit more involved than you really need 😁

0
Jason Lewins  Oct 6 to Jeffrey Drumm

Thanks for sending this but i still cant get it working. I have the following;

0
Jeffrey Drumm  Oct 6 to Jason Lewins

ORCgrp is a member of PIDgrpgrp and PIDgrpgrp is missing from your "if" statement. The condition should read:

..Contains(..ToUpper(source.{PIDgrpgrp(k1).ORCgrp(k2).OBXgrp(k3).OBX:ObservationValue()}),"DETECTED")

I don't know whether you're using the same doctype for the target, but if you are, the target path will need to be updated as well.

0