MEDITECH Dynamic Subscript Access
MEDITECH reports can be treacherous to modify, when design for change isn't worked in up front. /PROC.VOL (below) contains summarized data for an LSS/PBR CDM.

When the /PROC.VOL summarization is complete, the data could be accessed like this:
Q#1S^/DATABASE^@SEND.DATA,
Q#2S^/CPT.CODE^@SEND.DATA,
Q#3S^/PRACTICE^@SEND.DATA,
Q#4S^/EFF.DATE^@SEND.DATA,
Q#5S^/FEE.SCHED^@SEND.DATA,
Q#6S^/CHARGE^@SEND.DATA,
/PROC.VOL[Q]^/VOLUME^@SEND.DATA,
... but when reordering these fields later, I might introduce a bug, by misnumbering them.
To make accessing information from a MEDITECH array easier - dynamically access the data using a number. The key to this technique is Q#(X_"S").
Q represents all the subscripts read by >/PROC.VOL[Q]. Each value (/DATABASE,/CPT.CODE,/PRACTICE,/EFF.DATE,/FEE.SCHED,/CHARGE) is accessible in local variable Q. Q#0S accesses the value for /DATABASE, Q#1S for /PRACTICE - and so on.
Introducing local variable X allows you to access the values dynamically, by incrementing the value of X starting at 0-1. The first time you add 1 to X (value starts -1), the value will be zero. The next time you add 1 to X, the value is 1 - and so on.
Later ... when you want to re-order a field, no re-numbering.
Want an alert when the next post is published? Click the phone and Subscribe to the MEDITECH Reports Blog!