› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › HRL Question
I’m trying to create multiple messages from multiple rows in a flat file, the fields are all pipe delimited. The basic format of the file is:
01|…
02|…
02|…
02|…
01|…
02|…
01|…
02|…
… and so on…
A single 01 followed by one or many 02 record(s) will be one message.
I have created a 01Record.vrl and a 02Record.vrl to map out the fields. However I’m not sure how to properly define the HRL to get the multiple messages.
Currently my HRL is defined as follows:
{NAME Record01} {TYPE fmt} { FMT {
{ RECORD EKG_Extract_01Record.vrl }
{ RECORD_TYPE vrl }
}}
{NAME Record02} {TYPE fmt} { FMT {
{ RECORD EKG_Extract_02Record.vrl }
{ RECORD_TYPE vrl }
{ REPEATWHILE {
{
{ FIELD Record02.RecType }
{ VALUE 02 }
}
} }
}}
When I test one record there is data for the 1st VRL segment (Record01) but nothing for the 2nd VRL segment (Record02).
Looking at various posts, I got as far as I could. Any help would be appreciated.
Thanks,
Bart.
Bart,
What terminates ewach of the VRL records? I am guessing it is line feed.
In any case, whatever is the terminator, go to the VRL configurator and assure the Global Options specify the proper character set for termination.
Then reconfigure your Xlates to acquire the now updated HRL and give that a try.
I am guessing you are using the ‘Repeat While’ repetition choice in the HRL for your VRLs (you should have 2 VRLs).
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Hi Jim,
Yes I am using newline and it is defined in the global config. My HRL has both VRL. Only the 2nd VRL in HRL is defined with REPEAT WHILE.
I’m still testing the HRL through the testing tool. This is where I see that messages do not have both records populating. Record 01 is there but Record 2 is empty (see below ouput):
Command output:
MESSAGE 1
Field Number: 1
Field Name: Record01
— Begin VRL Segment Record01 —
Length of Repeat Field: 55
Repeat Field Offset from Field: 0
RecType: ch >01<
Facility: ch >1001<
SHCnum: ch >2001<
EMRN: ch >3001<
PatientLastName: ch >4001<
PatientFirstName: ch >5001<
PatientMiddleInit: ch >6001<
PatientSuffix: ch >7001<
PatientPrefix: ch >8001<
DOB: ch >9001<
Gender: ch >10001<
Race: ch ><
PatientAddress1: ch ><
PatientAddress2: ch ><
PatientCity: ch ><
PatientState: ch ><
PatientZip: ch ><
PatientCountry: ch ><
HomePhone: ch ><
VisitNumber: ch ><
PatientClass: ch ><
PatientLocation: ch ><
AdmissionType: ch ><
AttendingDocID: ch ><
AttendingDocLast: ch ><
AttendingDocFirst: ch ><
ReferringDocID: ch ><
ReferringDocLast: ch ><
ReferringDocFirst: ch ><
ConsultDocID: ch ><
ConsultDocLast: ch ><
ConsultDocFirst: ch ><
HospitalService: ch ><
AdmitSource: ch ><
AdmitDocID: ch ><
AdmitDocLast: ch ><
AdmitDocFirst: ch ><
DischargeDisp: ch ><
AdmitDate: ch ><
DischargeDate: ch ><
PlacerOrderNum: ch ><
OrderStatus: ch ><
QuantityTimingPriorityORC: ch ><
OrderingDocID: ch ><
OrderingDocLast: ch ><
OrderingDocFirst: ch ><
FillerOrderNum: ch ><
UniversalSericeIDcode: ch ><
UniversalServiceIDdes: ch ><
ObservationDateTime: ch ><
ResultRptStatusDT: ch ><
ResultStatusOBR25: ch ><
QuantityTimingPriorityOBR: ch ><
PrincipleInterpID: ch ><
PrincipleInterpLast: ch ><
PrincipleInterpFirst: ch ><
—- End VRL Segment Record01 —-
Field Number: 2 (empty)
Field Name: Record02
Thanks,
Bart.
Bart,
Sorry for asking basic questions…
Does the 01 record actually terminate only with a NL and does the first 02 record also actually terminate with a NL?
Also what style did you use for the file in the testing tool (if you used new-line that might not work – try eof).
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
If it were me I would normalize it to an HL7 message
Start with a dummy MSH then build Z01 and Z02 segments for the rest
Hi Jim, the terminating character for all records is 0xa and per your suggestion I have set global properties on the VRLs to match, however, my testing output of the HRL is still lacking the 02 Record data fields.
Charlie, normalizing via Tcl sounds like a great way to go, but I’d sure like to get a good handle on using HRL with VRLs.
If it starts taking me any longer I’ll probably go Charlie’s route…
Thanks again everyone for your time and guidance.
Bart.
Hi Bart,
Your setup looks ok.
First thing I would check is what Jim mentioned before: make sure you are using either ‘EOF Terminated’ or ‘Length Encoded’ and that you are processing all records in the HRL Testing Tool.
And your termination character is very important; should be x0A for newline. Also try to fill the last field of the 01-record with a value, so you have a better view of the result.
Having said that: I just tried to test a HRL (consisting of FRL’s though) I made and found out that I got the same issue you have: the ’02-record’ didn’t show in the testing tool. I then found out that I had extended the 01-record with a few a while ago, but was testing the HRL against old test-messages. When I tried new test-messages, all worked fine. So check if the 01- and 02-record comply with their respective VRL-definition by testing some separate lines against the VRL-definition.
Another thing that could have gone wrong: the first field in the ‘EKG_Extract_02Record.vrl’ should be named ‘RecType’. Or else your RepeatWhile won’t work.
Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands
Hi Robert,
Thanks for your input. Looks like I’m getting data now (at least in the testing tool), I’m glad you and Jim had me check my terminator characters again in my VRL global properties. I had xa instead of x0a. I also had to create a HRL within an HRL (this stuff is confusing). My current HRL contains a repeating VRL for the 01 record and an additional HRL with a repeating VRL for the 02 records. Seems to work, time will tell.
Basic structure:
HRL
VRL (repeats for 01 records in a file)
HRL
VRL (repeats the 02 records under the 01 record)
Detailed HRL structure for the 01 (VRL) and 02 records (HRL):
{NAME Record01} {TYPE fmt} { FMT {
{ RECORD EKG_Extract_01Record.vrl }
{ RECORD_TYPE vrl }
{ REPEATWHILE {
{
{ FIELD Record01.RecType }
{ VALUE 01 }
}
} }
}}
{NAME Segment} {TYPE fmt} { FMT {
{ RECORD test_bart_HRL02.hrl }
{ RECORD_TYPE hrl }
}}
Detailed structure for the second HRL for the 02 records
{NAME Record02} {TYPE fmt} { FMT {
{ RECORD EKG_Extract_02Record.vrl }
{ RECORD_TYPE vrl }
{ REPEATWHILE {
{
{ FIELD Record02.RecType }
{ VALUE 02 }
}
} }
}}
And this is not even getting to the Xlate. Now I know why Charlie advised (correctly) to use Tcl to create a dummy message (MSH, Z01, {Z02}). Now to spend some time figuring out Tcl to split up the file to multiple messages… this is getting fun… I learned a lot regarding HRL/VRL.
Thanks all and Merry Christmas and have a Happy 2011.
Bart.
Hi Bart,
Good to hear you got some results. Never hurts to check thing twice. Or thrice…
I am just wondering why your initial HRL didn’t work for the ‘one 01 record, followed by one or more 02 records’ message. Looked good to me! The HRL you have now looks very confusing: an iteration for the 01 record when you only expect one? And creating the extra HRL for the 02 record looks like overkill.
So I checked of few of my HRLs. I have one made with FRLs:
{NAME header} {TYPE fmt} { FMT {
{ RECORD specbrief_header.frl }
{ RECORD_TYPE frl }
}}
{NAME tekst} {TYPE fmt} { FMT {
{ RECORD specbrief_tekst.frl }
{ RECORD_TYPE frl }
{ REPEATWHILE {
{
{ FIELD tekst.segmentnaam }
{ VALUE TXT }
}
} }
}}
This one looks like yours, except with FRLs. You do need to create a tcl script to split the messages yourself.
And I have onde with VRLs:
{NAME LEM} {TYPE fmt} { FMT {
{ RECORD ish_afspr_lem.vrl }
{ RECORD_TYPE vrl }
{ REPEATWHILE {
{
{ FIELD LEM.segnaam }
{ VALUE LEM }
}
} }
}}
{NAME TMN} {TYPE fmt} { FMT {
{ RECORD ish_afspr_tmn.vrl }
{ RECORD_TYPE vrl }
}}
{NAME ANF} {TYPE fmt} { FMT {
{ RECORD ish_afspr_anf.vrl }
{ RECORD_TYPE vrl }
}}
{NAME GPA} {TYPE fmt} { FMT {
{ RECORD ish_afspr_gpa.vrl }
{ RECORD_TYPE vrl }
}}
{NAME PAT} {TYPE fmt} { FMT {
{ RECORD ish_afspr_pat.vrl }
{ RECORD_TYPE vrl }
}}
I am wondering now why I put the repeating record (LEM) at the top. Can’t remember if it didn’t work for Cloverleaf if I put them at the end, or if I had problems creating the message in the source (I programmed this myself in SAP).
BUT: if it works and you’re satisfied with it, just leave it as it is!!
Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands
Hi Robert,
You’re correct a single HRL with a VRL for the 01 followed by a VRL for the 02 that is repeating would be nice. I created the HRL within the HRL business since I had a pseudo test file with multiple 01 and associated 02 records. This overkill HRL was to handle this scenario since I did not have a Tcl proc to break up the messages, if I did then the more direct HRL could have been used. I’m still trying to figure out how to split up the file to multiple messages so I can use the more simplified HRL or just go with the dummy message and create a variant to xlate with.
Thanks,
Bart.