GMTSUCUM ;SLC/PKR - Utility for UCUM codes. ;02/03/2022
;;2.7;Health Summary;**115**;Oct 20, 1995;Build 190
;
; API ICR#
;UCUMDATA^LEXMUCUM 6225
;
;===================
UCUMFIELDS(IDEN,FIELDS) ;Given an identifier, which can be an IEN, a
;Description, or a UCUM and a semicolon separated list of fields return
;the fields as a semicolon separated string. Return -1 is the UCUM entry
;does not exist. The fields that can be returned are: COMMENTS, DESCRIPTIION,
;IEN, ROW, UCUM CODE,
N FIELD,FIELDSTRING,IEN,IND,NFIELDS,UCUMDATA
S NFIELDS=$L(FIELDS,";")
I NFIELDS=0 Q 0
D UCUMDATA^LEXMUCUM(IDEN,.UCUMDATA)
S IEN=$O(UCUMDATA(""))
I $D(UCUMDATA(IEN,"ERROR")) Q -1_";"_UCUMDATA(IEN,"ERROR")
S FIELD=$P(FIELDS,";",1)
S FIELDSTRING=UCUMDATA(IEN,FIELD)
F IND=2:1:NFIELDS D
. S FIELD=$P(FIELDS,";",IND)
. S FIELDSTRING=FIELDSTRING_";"_UCUMDATA(IEN,FIELD)
Q FIELDSTRING
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMTSUCUM 937 printed Nov 22, 2024@17:10:34 Page 2
GMTSUCUM ;SLC/PKR - Utility for UCUM codes. ;02/03/2022
+1 ;;2.7;Health Summary;**115**;Oct 20, 1995;Build 190
+2 ;
+3 ; API ICR#
+4 ;UCUMDATA^LEXMUCUM 6225
+5 ;
+6 ;===================
UCUMFIELDS(IDEN,FIELDS) ;Given an identifier, which can be an IEN, a
+1 ;Description, or a UCUM and a semicolon separated list of fields return
+2 ;the fields as a semicolon separated string. Return -1 is the UCUM entry
+3 ;does not exist. The fields that can be returned are: COMMENTS, DESCRIPTIION,
+4 ;IEN, ROW, UCUM CODE,
+5 NEW FIELD,FIELDSTRING,IEN,IND,NFIELDS,UCUMDATA
+6 SET NFIELDS=$LENGTH(FIELDS,";")
+7 IF NFIELDS=0
QUIT 0
+8 DO UCUMDATA^LEXMUCUM(IDEN,.UCUMDATA)
+9 SET IEN=$ORDER(UCUMDATA(""))
+10 IF $DATA(UCUMDATA(IEN,"ERROR"))
QUIT -1_";"_UCUMDATA(IEN,"ERROR")
+11 SET FIELD=$PIECE(FIELDS,";",1)
+12 SET FIELDSTRING=UCUMDATA(IEN,FIELD)
+13 FOR IND=2:1:NFIELDS
Begin DoDot:1
+14 SET FIELD=$PIECE(FIELDS,";",IND)
+15 SET FIELDSTRING=FIELDSTRING_";"_UCUMDATA(IEN,FIELD)
End DoDot:1
+16 QUIT FIELDSTRING
+17 ;