› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Need to get a part of a field
I am trying to to get from the pv2_23_0 just the following ADED
eg. :ADULT EMERGENCY MEDICINE;D;ADED;;;;XX:
and I would like to do this in a xlate.
Thanks in advance
Yamil
Can you explain your data in a little more details? For example, will the field always be delimited by semicolons and will the piece of the data that you want to extract always be in the same place?
If so, here is one way that might work for you.
set xlateOutVals [list [lindex [split [lindex $xlateInVals 0] ;] 2]]
-- Max Drown (Infor)
Try changing it to just this:
set xlateOutVals
2]]
or if you have more than one input source, set the xlateInVals to a variable first
set clinic [lindex $xlateInVals 0]
set xlateOutVals list [lindex [split [lindex $clinic ;] 2]]
Hope this helps….
Tom
Odd. It works for me from a test script.
set xlateInVals [list “:ADULT EMERGENCY MEDICINE;D;ADED;;;;XX:”]
set xlateOutVals [list [lindex [split [lindex $xlateInVals 0] ;] 2]]
puts [lindex $xlateOutVals 0]
Put that code into a file called test.tcl and then run “tcl test.tcl” from the command line.
-- Max Drown (Infor)
The semicolons may be screwing up the data. I’ll try it out in an xlate asap.
-- Max Drown (Infor)
-- Max Drown (Infor)
Incidentally, I have tried both Max’s code and my code in an xlate with the data provided and it should work for you Yamil. If you are still having difficulty, maybe copy/paste some details showing us how you have it set up.
Thanks….Tom
It is always best to treat the xlate variables as lists.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Since I always use the list reference, I can’tsay I have ever kicked the tires on inbound fields. Perhaps Xlate is not so sensitive with those.
However, I feel I would rather be safe than have to remember when to use list notation and when not to.
Using list notaitn has never caused me an issue – forgetting to use has caused me grief.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
I do have another question but I will start a new topic for it.
Hi Thomas and Jim
I have attach a screen shot of my translation configurator.
This my message when I run the routes testing
omnicell_Adt_Out MSH|^~&|STAR|S|CERNER|S|20090604084354||ADT^A08|92064|P|2.2|92064||AL
EVN|A08|20090604084354|||RT
PID|1||^^^^PI|||||F||O|262 SUYDAM ST APT 1^^NEW ||||||||N|||N|||N
PV1|1|E||1||||||XED||||7||||ER||MM|||||||||||||||||||S||0|||200906040750
I must be doing some wrong but do not know why
Thanks for all your answer and help
Yamil
Try attaching the screen shot again
Tom
-- Max Drown (Infor)
Just a note, when I put a space between them using the code, the first word I got in the destination field was “MEDICINE”.
Hope this helps…
Tom
-- Max Drown (Infor)
When you do not put a space between you get nothing.
See examples
Thanks…Tom
Is the Component Separator in MSH-2 a semi-colon ‘;’? Maybe all you need to do is select the correct field component.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Thanks
Data” :ADULT EMERGENCY MEDICINE;D;ADED;;;;XX:
Use “0(0).PV2(0).#23(0).[2]” as your inbound field.
Notice the “[2]”.
-- Max Drown (Infor)
So you notation should be somehting like 0(0).PV2(0).#23(0).[0].[2].
The first [0] points to the component, the second [2] points to the sub-component.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
-- Max Drown (Infor)