Question
· Oct 9, 2023

How to truncate OBX 5 values that are being evaluated by BPL

I have a BPL that checks if at least one of the incoming OBX 5 values exists in TestTable. If the value exists it gets passed to Operation A and if it doesn't exist it gets passed to Operation B. The lookup table has keys that range between 10 to 70 characters. However, the incoming message sometimes has OBX 5 values that are greater than 510 characters which causes the BPL to terminate and the message does not get sent to any operation. So, my question is, how do I truncate the incoming OBX 5 values before they get passed to the BPL so that what is passed to the BPL is always between 10 and 300 characters? 

 

Edited to add:

Interface is designed not to use any rules, only BPL so any suggestions should please take that into account. 

Product version: IRIS 2021.2
Discussion (9)3
Log in or sign up to continue

Thank you @Luis Angel Pérez Ramos I used your suggestion and it worked.  Thank you @Jeffrey Drumm for showing me how to set the EXTRACT function. I used $EXTRACT(context.ObxTrunc,1,470) where context.OBxTrunc is the context variable holding the original message.  

In the BPL, I passed the message through the newly created DTL that was looking if the OBX 5 characters(bytes) were greater than 400, if so, I took the substring of the first 470. (I tried taking 480/ 490/ 500 but that would cause the message to error) then following Luis's suggestion, I defined another context variable with the same type than the original message as output. 

Can you share the error message generated by the BPL when it terminates?

You should be able to assign the return value of $EXTRACT(request.{OBX:5},1,510)}* to a context variable and use it in place of the original OBX:5 path in the lookup function. However, if the OBX:5 is longer than the maximum string size in IRIS (i.e. it's a stream), you may  need to include logic to check for that, then read just the first 510 bytes.

* The path to the OBX segment is likely different than what's in my example ... you'll need to supply the correct path.

@Jeffrey Drumm please see below. 

Error 1:

ERROR <Ens>ErrException: <SUBSCRIPT>zExists+1^Ens.Util.FunctionSet.1 ^Ens.LookupTable("TestTable","The patient came in accompanied by their daughter.. Time-out was -- logged as '-' number - @''
 

Error 2:

ERROR <Ens>ErrBPTerminated: Terminating BP TestRsltRouter # due to error: ERROR <Ens>ErrException: <SUBSCRIPT>zExists+1^Ens.Util.FunctionSet.1 ^Ens.LookupTable("TestTable","The patient came in accompanied by their daughter.. Time-out was -- logged as '-' number - @''
> ERROR <Ens>ErrException: <SUBSCRIPT>zExists+1^Ens.Util.FunctionSet.1 ^Ens.LookupTable("TestTable","The patient came in accompanied by their daughter.. Time-out was -- logged as '-' number - @''