Access Index Value as a Data Element
Do you ever find that you've been looking at something one way; only to have the light bulb come on and see things in a different light? I do.
What I am about to share is one of the basest of concepts. And yet I'd missed it until modifying another programmer's NPR report. That is the fun in keeping your eyes open while you work. You find you're always learning and fine tweaking what you know.
room.bed.index
[facility,room,bed] = urn
?(A)AARB[gqb,ggr,ggrB]
schedule.index
[facility,status.type,date,urn] = 1
?(A)AASI[gqb,aaST,aaDT,aa]
Consider both indexes above. Until now, I would loop thru the @room.bed.index using a DO LOOP and then assign the value to a variable and go on my way:
"MAIN.FAC"^facility,""^/Q,
DO{>?(A)AARB[@facility,/Q],/X)^/Q /Q#0S^/ROOM,/Q#1S^BED,/X^urn,@DO.SOMETHING}
What I never thought about is using the name of the structure like this: @room.bed.index^urn.
"MAIN.FAC"^facility,""^room^bed,
DO{+?(A)AARB[@facility,@room,@bed]^bed @room.bed.index^urn,@DO.SOMETHING;
+?(A)AARB[@facility,@room]^room ""^bed}
Until today, it hadn't occurred to me to use the index @room.bed.index to get the value for @urn. You could even use this principle with the @schedule.index to check for the existence of a record.
IF{@schedule.index @DO.SOMETHING;@DO.SOMETHING.ELSE}

1 Comments:
What does this @Root() function do?
I want to know what does @Root function return?
I have a code that has @Kill(@Root(@BAR.PAT.pe.status.vector)).
This does not allow me to file the macro.
When i run the report it crashes..
With what code I should replace this?
Post a Comment
Links to this post:
Create a Link
<< Home