Extracting last value in a repeating field
Hi,
I have a PV1 repeating field that can contain multiple or a single value. I'd like to always pull the last value in the field but am not sure how to configure this in my DTL.
The repeating field is in PV1:50().1
Could somebody shed some light on this?
Examples:
|15081942~15081951~15108961~15280550|
|15081947|
|15081939~15081940|
Thanks
Product version: Ensemble 2017.1
One way you can do this is using the function Piece.
https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=RBAS_fpiece
Thanks, I did try this but was receiving errors. This was the syntax I was using in the DTL:
..Piece(source.{AlternateVisitID().ID},"~",,*)
This is the full PV1 segment:
PV1|1|O|NPID15T^MEDIFREN^^^^^^^NURSE LED "TB" TELEPHONE CLINIC|||||||||||||||1|015728690002||||||||||||||||||||||||||20210203114600|||||15081942~15081951~15108961~15280550
Assuming CacheBasic supports an asterisk as per ObjectScript (it is not mentioned in that documentation), I think it should be in the 'From' field not the 'To' field, i.e. one less comma before *.
I am not quiet sure your syntax is correct is probably should be
..Piece(source.{PV1:AlternateVisitID},"~",*)
or
source.{PV1:AlternateVisitID(~).IDNumber}
https://docs.intersystems.com/healthconnectlatest/csp/docbook/DocBook.UI.Page.cls?KEY=EEDI_virtual_property_paths
Hi,
I managed to get this to work thanks to a call to the WRC. Here is the DTL setting I required in case anyone else has similar issues...