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
Comments
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:
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$ZCONVERTor equivalent functions with case-insensitive checks [1][2].Setup Data Transformation Logic:
- Use a
foreachloop 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
$FINDor$ZCONVERTfor case-insensitivity). - If detected, set the Abnormal Flag in OBX 8 using
SetValueAt[1].
- Use a
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:
Use a combination of the ToUpper() and Contains() methods in the Function list with an if rule:
.png)
The AI Bot offers another option, but it's probably a bit more involved than you really need 😁
Thanks for sending this but i still cant get it working. I have the following;
.png)
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.