Lisa:
I took another look at this and assume you will process multiple records and only want headers on the first. Is this VRL defined as CSV? If so be careful as VRL does not handle embedded commas well.
At any rate, assume you have some HL7 messages in and you will be copying to a VRL and you want headers only in the first record. Try something like below. You should be able to manipulate the iea to fit your needs
prologue
xlt_infile: hl7 2.3.1 DFT_P03
who: Charlie Bursell
date: July 2, 2016 10:19:34 AM ICT
xlt_outfile: vr cbtest.vrl
type: xlt
version: 7.0
end_prologue
{ { OP COPY }
{ ERR 0 }
{ IN =1 }
{ OUT @flag }
}
{ { OP COPY }
{ ERR 0 }
{ PRE {
if {![info exists foobar]} {
set foobar 1
VrioLoadData v cbtest.vrl
foreach fld [VrioGetFieldList v] {xpmstore $xlateId $fld c $fld}
} else {
xpmstore $xlateId @flag c 0
}
}}
{ IN @null }
{ OUT @null }
}
{ { OP IF }
{ ERR 0 }
{ COND {@flag eq =1} }
{ THENBODY {
{ { OP CONTINUE } }
}}
{ ELSEBODY {
}}
}
{ { OP COPY }
{ ERR 0 }
{ IN {{0(0).PID(0).#5(0).[0]}} }
{ OUT fld1 }
}
{ { OP COPY }
{ ERR 0 }
{ IN {{0(0).PID(0).#5(0).[1]}} }
{ OUT fld2 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).PID(0).#7(0) }
{ OUT fld3 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).PID(0).#11(0) }
{ OUT fld4 }
}