Homepage › Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Need to get a part of a field
- This topic has 28 replies, 4 voices, and was last updated 14 years, 6 months ago by
Max Drown (Infor).
-
CreatorTopic
-
June 4, 2009 at 2:30 pm #50936
Yamil Velez
ParticipantHi 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
-
CreatorTopic
-
AuthorReplies
-
-
June 4, 2009 at 2:56 pm #68075
Max Drown (Infor)
ModeratorCan 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.
Code:set xlateOutVals [list [lindex [split [lindex $xlateInVals 0] ;] 2]]
-- Max Drown (Infor)
-
June 4, 2009 at 3:01 pm #68076
Yamil Velez
ParticipantYes it would always be separate by a semicolon -
June 4, 2009 at 3:05 pm #68077
Yamil Velez
ParticipantI am getting just medicine -
June 4, 2009 at 3:18 pm #68078
Tom Rioux
ParticipantTry 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
-
June 4, 2009 at 4:12 pm #68079
Max Drown (Infor)
ModeratorOdd. It works for me from a test script.
Code: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)
-
June 4, 2009 at 4:20 pm #68080
Max Drown (Infor)
ModeratorI do not recommend using “[split $xlateInVals ;]” because xlateInVals is a list variable. You never know when you’ll get data in that will bite you right on the tail. Always treat xlateInVals and xlateOutVals as list variable. The semicolons may be screwing up the data. I’ll try it out in an xlate asap.
-- Max Drown (Infor)
-
June 4, 2009 at 4:41 pm #68081
Max Drown (Infor)
ModeratorI created a test xlate. The code I provided with the data you provided works perfect for me. I used PV1.03 as a -- Max Drown (Infor)
-
June 4, 2009 at 4:57 pm #68082
Tom Rioux
ParticipantI would agree with you in most cases, but since we are specifying a particular subfield PV2.23.[0], unless there are multiple source fields listed, then “[lindex $xlateInVals 0]” or $xlateInVals will return the same value. I totally agree, I would be careful of using just the InVals designation if specifying only something like PV2.23. That will bite you on the tail. 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
-
June 4, 2009 at 5:04 pm #68083
Jim Kosloskey
ParticipantActually if the field has white space, then not specifying via a list reference may return only a part of the field/component. It is always best to treat the xlate variables as lists.
email: jim.kosloskey@jim-kosloskey.com
-
June 4, 2009 at 5:17 pm #68084
Tom Rioux
ParticipantThe field in question did in fact have white space and by specifying the subfield designation (i.e. PV2.23.[0]) with $xlateInVals only, it still returned the whole subfield. Is this something that should be concerning???? -
June 4, 2009 at 5:28 pm #68085
Jim Kosloskey
ParticipantInteresting. 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
-
June 4, 2009 at 5:41 pm #68086
Tom Rioux
ParticipantI’ve always been sure to use it on an OutVal. As I’ve mentioned before, I never had a concern about using InVal alone so long as I was referencing a subfield and not an entire field. That is curious. I do have another question but I will start a new topic for it.
-
June 4, 2009 at 5:55 pm #68087
Yamil Velez
ParticipantHi 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
-
June 4, 2009 at 5:57 pm #68088
Tom Rioux
ParticipantYamil, Try attaching the screen shot again
Tom
-
June 4, 2009 at 6:04 pm #68089
Yamil Velez
ParticipantHere it is again -
June 4, 2009 at 6:20 pm #68090
Max Drown (Infor)
ModeratorCan you paste the entire hl7 message, please? -- Max Drown (Infor)
-
June 4, 2009 at 6:23 pm #68091
Tom Rioux
ParticipantIt appears you have a space between the backslash (“”) and the semicolon. Push them together like “;” and you should get your desired results. 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
-
June 4, 2009 at 6:25 pm #68092
Max Drown (Infor)
ModeratorGood eye, Tom. -- Max Drown (Infor)
-
June 4, 2009 at 6:34 pm #68093
Yamil Velez
ParticipantHi Tom and Max When you do not put a space between you get nothing.
See examples
-
June 4, 2009 at 6:42 pm #68094
Tom Rioux
ParticipantCopy and paste the original PV2 segment into a message for us to see Thanks…Tom
-
June 4, 2009 at 6:56 pm #68095
Yamil Velez
ParticipantMessage with original PV2 segment -
June 4, 2009 at 7:06 pm #68096
Jim Kosloskey
ParticipantYamil, 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
-
June 4, 2009 at 7:09 pm #68097
Yamil Velez
ParticipantNo the component separate is : -
June 4, 2009 at 7:25 pm #68098
Yamil Velez
ParticipantI meant that the separator is “:” a colon Thanks
-
June 4, 2009 at 7:29 pm #68099
Max Drown (Infor)
ModeratorOh. You are using “:” and “;” as the HL7 field delimiters instead of the default “^” and “&”. So, you should be able to pull the field out without using any tcl code. 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)
-
June 4, 2009 at 7:53 pm #68100
Jim Kosloskey
ParticipantIt looks like the ; semi-colon is the sub-component separator. 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
-
June 4, 2009 at 8:06 pm #68101
Yamil Velez
ParticipantThat brings up nothing see illustration -
June 4, 2009 at 8:37 pm #68102
Max Drown (Infor)
ModeratorRemove the tcl fragment. You don’t need it. -- Max Drown (Infor)
-
-
AuthorReplies
- The forum ‘Cloverleaf’ is closed to new topics and replies.