infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Cloverleaf
Convert OBX to NTE using Xlate
jdInforComm
Hello - I need to convert two OBX segments into multiple NTE segments using an xlate.
OBX segments to be converted are identified by a value in OBX.3. There should always be 2 OBX segments to convert.
I can capture the OBX segments to be converted, but need nsight into parsing the OBX.5 values and putting them into their own NTE segment. Sample input and desired output below. Thanks in advance!
OBX|3|ST|123-1||Orthopedic Institute LLC, CLIA 000000111||||||F||||||||^M
OBX|4|ST|123-2||122233 Great Canyon Ave, Great City CA 90001, First M Last MD||||||F||||||||
Output Should be:
NTE |1|P|Orthopedic Institute LLC
NTE |2|P|CLIA 000000111
NTE |3|P|122233 Great Canyon Ave
NTE |4|P|Great City CA 90001
NTE |5|P|First M Last MD||
Find more posts tagged with
Clovertech
Comments
Paul Bishop
So it looks like you will be splitting the source data by the comma? You should be able to do this fairly simply in a translate with some in-line TCL coding. You will need to set and increment the NTE segment index within the translate, including any other NTE segments that are copied from the original message. Pseudo code wise it would look something like this:
Initialize the outbound NTE segment index to zero (copy =0 to $%s91)
Initialize the outbound NTE-1 field to one (copy =1 to
@nte_cntr)
start looping over the inbound OBX segments.
For the OBX segment with OBX-3 equal 123-1, copy OBX-5 to
@nte_name
and
@nte_clia
using a TCL snippet:
lassign $xlateInVals in_obx_5
set out_name [lindex [split $in_obx_5 ","] 0]
set out_clia [lindex [split $in_obx_5 ","] 1]
set xlateOutVals [list $out_name $out_clia]
copy
@nte_cntr
to the NTE(%s91)-1 field, "P" to the NTE(%s91)-2 field, and
@nte_name
to the NTE(%s91)-3 field
increment $nte_cntr and $%s91 by 1
copy
@nte_cntr
to the NTE(%s91)-1 field, "P" to the NTE(%s91)-2 field, and
@nte_clia
to the NTE(%s91)-3 field
For the OBX segment with OBX-3 equal 123-2, copy OBX-5 to
@nte_addr_1
,
@nte_addr_2
, and
@nte_provider
using a TCL snippet:
lassign $xlateInVals in_obx_5
set out_addr_1 [lindex [split $in_obx_5 ","] 0]
set out_addr_2 [lindex [split $in_obx_5 ","] 1]
set out_provider [lindex [split $in_obx_5 ","] 2]
set xlateOutVals [list $out_addr_1 $out_addr_2 $out_provider]
copy
@nte_cntr
to the NTE(%s91)-1 field, "P" to the NTE(%s91)-2 field, and
@nte_addr_1
to the NTE(%s91)-3 field
increment $nte_cntr and $%s91 by 1
copy
@nte_cntr
to the NTE(%s91)-1 field, "P" to the NTE(%s91)-2 field, and
@nte_addr_2
to the NTE(%s91)-3 field
increment $nte_cntr and $%s91 by 1
copy
@nte_cntr
to the NTE(%s91)-1 field, "P" to the NTE(%s91)-2 field, and
@nte_provider
to the NTE(%s91)-3 field
It's important to set the xlateOutVals value using the list command so your values are set to the correct variables.
If you need more information, let me know and I can help you through it over email.
Charlie Bursell
You don't say, but where in the OB message do the NTE segments go> Are they the last segments? Do the OBX segments, and others, remain positionally the same?
Any reason not to do this Tcl? A lot less convoluted and easier to maintain.
jdInforComm
Appreciate the reply and info; frankly at this point I'm tcl challenged and was trying to do this in an xlate. I need to play around with tcl a lot more. Thanks again
jdInforComm
Hello - the obx segments with the -1/-2 will turn into NTE segments. Just before the OBX segments with the -1/-2 there is an OBX segment that will go with newly created NTE segments. Trying to do this in an xlate. Thanks
OBX|2|ST|123||See details below||||||F||||||||
OBX|3|ST|123-1||Orthopedic Institute LLC, CLIA 000000111||||||F||||||||^M
OBX|4|ST|123-2||122233 Great Canyon Ave, Great City CA 90001, First M Last MD||||||F||||||||
Output Should be:
OBX|2|ST|123||See details below||||||F||||||||
NTE |1|P|Orthopedic Institute LLC
NTE |2|P|CLIA 000000111
NTE |3|P|122233 Great Canyon Ave
NTE |4|P|Great City CA 90001
NTE |5|P|First M Last MD||
Paul Bishop
The TCL portion is written out for you in my first post (starting with the "lassign" line and ending with the "set xlateOutVals" line.
As with most things in Cloverleaf, there are multiple ways to get to the end results you want. With the given information, I would probably do this in a translate as opposed to writing a TCL proc, but that could also change depending on if other parts of the message are being translated as well.
Charlie Bursell
Paul:
To each his own :-) But your Xlate example does not address the rest of the message, i.e., remove the two OBX segments after processing and making sure the MSH, etc. and other segments are as desired.
You know me, I am a Tcl guy and still believe that Tcl, or other languages now, is one of the main strengths of Cloverleaf. Much more maintainable, with proper comments, in cases such as this.
Jim Kosloskey
If on later release of CL, the STRING Action has a function you can use for the string stuff insteD of Tcl if string Tcl is your only issue.
I am willing to help if you like - email me.
jdInforComm
Thank you for all the information - well appreciated! Have done the mapping in xlate with a sr. analyst.