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
Read Only Archives
Cloverleaf
Cloverleaf
splitting a field
Kevin Crist
i have a question about splitting a field and moving part of it to another field using an xlate.
In the OBR-2 & ORC-2 we have an order# coming from one system and i need to take last part of the number, _L02115-1 in this case and move that to the OBR-3 & ORC-3 while removing the underscore. So i would have it end up looking like this ORB|1|396336|L02115-1. I do not need the info that is already in the OBR-3 & ORC-3. I also need to accomplish the same this with the PV1-3 location, except moving the -1(or whatever # is there) to the next subfield. I figured it would be same thing for both cases.
Thanks for help and ideas.
0(0).MSH(0) : >|^~&|WG|100|ORCHARD|HARVEST|200905131306||ORU^R01|3272|D|2.3|||AL||US||ENG<
1(0).0(0).0(0).PID(0) : >||001747|001747||VADER^DARTH||195004200000|M||W||||||||9000000849|159159159<
1(0).0(0).1(0).PV1(0) : >|1|I|4E^412-1^^GSH||||||||||||||||9000000849|||||||||||||||||||||||||200905130000<
1(0).1(0).0(0).ORC(0) : >|RE|396336_L02115-1|162X1^ST-TX||||1^^^200905131157^^S||200905131158|||0686^CARANDANG^REYNALDO<
1(0).1(0).0(0).OBR(0) : >|1|396336_L02115-1|162X1^ST-TX|IAT^INDIRECT COOMBS|S|200905131157||||||||200905131157||||||||||BLB|||1^^^200905131157^^S<
1(0).1(0).1(0).OBX(0) : >|1|TX|GELSCRR3^3 cell Gel Screen^^454|1|NEGATIVE||||||F|||||SYSADMIN^System^Administration<
1(0).1(0).1(1).OBX(0) : >|2|TX|SI^Status Information|1|Completed|||||||||||HL7^System^HLSeven<
Find more posts tagged with
Clovertech
Comments
Tom Rioux
Kevin,
You can use the split command to split the value based on a certain character. In the OBR/ORC case you can split it on the underscore. In the PV1 case, you can split on the hyphen. Once you have accomplished the split, the use the lindex command to grab whatever value you want from you new list and place it into your designated HL7 field.
Hope this helps.
Thanks...Tom
Kevin Crist
Would something like this work. i have found an example in one of our other sites that seems to be doing something very similiar, but it is not working for my situation.
Charlie Bursell
A simple solution
COPY OBR.#2 -> {OBR.#2 ORC.#2}
A tcl frgment like
set inp [string map "_ {}" [lindex $xlateOutVals 0]]
set xlateOutVals
For the PV1COPY PV1.#3.[1] -> {PV1.#3.[1} PV!.#3.[2]}A tcl FRagmentset inp [lindex $xlateInVals 0]set xlateOutVals
KISS
Russ Ross
If you are like us and don't allow in-line TCL code to be used in xlates then check out my example of how to split a field using our xlt_spltflds.tcl proc at the following URL:
CALL in Xlate
If you don't want to map the first item(s) of the split filed then just copy them to a
@dummy1
temp variable on the outbound side
Kevin Crist
Thanks everyone...
just out of curiosity...i know different places do things differently so why do you not allow in code fragments
Russ Ross
Please consider my answer an opinion that has evloved based on our current experience because soemtiems answers like these are misinterpeted as factual and it is only factual for us.
The reason one of our instutuional standards has evloved to never allow the use of any in-line TCL code in our xlates is:
- easier maintenance
- easier cloverleaf upgrades with less risk
- easier to leverage and reuse code
- better leverage skill set of staff
With hundereds of sites and thousands of threads it has turned out to be one of our better decisions.
It is a bit more annoying at first, so people that just want instant gratification will be out of their comfort zone.
My priority is maintenance because this is my home and I have to support our work.
If I were a contractor hired to get it done then my priority would be different and using in-line code might be the right choice in that situation.
I guess what I'm saying is I've done it both ways for many years and found it more than worth the trouble.
My natural progession was to start out with in-line TCL code for several years until I became more experienced and grew my comfort zone then progressed to only using TCL xlt procs.
I also would like to acknowledge my co-worker Jim Kosloskey for mentoring me in this area and speeding up my learning time.
Even I sometimes find myself feeling pressured to just put a quick in-line TCL snippet to do something qucik like maybe echo out a variable for debugging.
Then I realize I'm regressing back to something I evloved from.
After taking a quick look at what is available for reuse, sure enough I find one of my co-workers (Jim Kosloskey) has even written a TCL xlt proc to echo out variable(s) for debugging purposes.
If there is a down side to this approach it is that you reach a point where you don't have to write any more TCL code because you've got most everything you need then your TCL skills get rusty.
Having said that, this approach also makes it easier for employees that aren't TCL proficient to get more accomplished.
They might not be able to write a TCL proc but most anyone able to keep a job should be albe to call a TCL proc that is already written.
That means now you also leverage all your employees more effectively.
Charlie Bursell
There are 3 ways of doing things:
right way
wrong way
Russ Ross way
Kevin Crist
Thanks. Since i have only been doing this a year, it is interesting to see how other people/facilities handle things.