Business Rule Looping
Does anyone know how to loop through a segment that is part of an ordered set in a Business Rule and if one of about 10 possible values exist in any of the iterations of the segemnt:field I then allow the message to be skipped?
It seems like it should be fairly simple, but i am having a difficult time figuring this out. The Contains function only allow for one value to be identified. I have tried the intersectsList and while I think I have it formatted correctly i believe it only allows for 4 values to be verified.
could you share your code ?
I was able to get the intersectsList function to work. However it doesn't completely satisfy my need. I may need to create a BPL like Neerav mentioned below.
I don't think Business Rules are meant to do the looping. They are more for higher level logic and conditions.
For more inner level Transformations and BP's should be used as they have an inbuilt functionality of loops for the same reason
Just my 2 cents.
I will give this a shot and see if I can make it work. Thank you.
We've have done something similar but wrote a function to do the looping... This example loops through a given segment and field and looks that value up against a lookup table. This could be modified for your use. This is the only way I know to do the looping within the BusinessRule.
{
#dim tSeg as EnsLib.HL7.Segment
set tSegCount = pHL7Msg.SegCountGet()
set i = 1
Set tFound = 0
//get new values
set 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 '= "")
{
Q 1
}
quit 0
}