Question Yuhong Snyder · Dec 23, 2024

in business rule , it cannot valuate the value in iteration?

We have a customized doctype with iterated PIDgrp, so I have a rule that needs to evaluate the pv1:3.1 value to decide which operation the HL& message should go, so I debugged the value in the rule and it definitely should go to the when #2 but it just won't.  so did I do anything wrong or it is just the InterSystems doesn't like the iteration value here? I only need to evaluate the first pv1:3.1

Product version: IRIS 2024.3

Comments

Yuhong Snyder · Dec 23, 2024

I got with the resource and this is clarified, with when, only the first true condition will be executed. any other condition after the first one won't be executed.

0
Scott Roth · Dec 27, 2024

I ended up writing a function with some help from the Developer community to do this. The function basically iterates through the the HL7 message and check it against a Data Lookup Table. I am in the office in two week and will share it once I am back in the office.

0
Scott Roth · Jan 15
ClassMethod GroupIDExists(pHL7Msg As EnsLib.HL7.Message, pSegment As%String, pField As%String, pLookupTable As%String) As%Boolean
{
            #dim tSeg as EnsLib.HL7.Segment
            
            set tSegCount = pHL7Msg.SegCountGet()
            set i = 1Set tFound = 0//get new valuesset tval=""while ((i <= tSegCount) && (tval="")) {
                         
                        set tSeg = pHL7Msg.GetSegmentAt(i)
                        if (tSeg.Name = pSegment) {
                                    set tID = tSeg.GetValueAt(pField)
                                    set tval= ..Lookup(pLookupTable, tID)
                                                            
                        }
                        set i = i + 1 
            }
            if (tval '= "")
            {
                        Q1 
            }
            quit0
}

An example....

0