When we first started, we found how inconvenient it is to have the field positions hard coded, ie., have statements like @name^/MV[“ORD”,/MVROW,10]
and moved quickly to a scheme where we’d have:
AL START 10^/MV.POS[“ORD”] and subsequently, @whatever^/MV[“ORD”,/MVROW,/MV.POS[“ORD”]+4]
If a new field unrelated to the MV was inserted, all you needed was a change in the starting variable position in one place.
Since we have many people now who make simple edits to reports and don’t want to edit such code, I changed the scheme a few years ago to calling NPR.REP at the start of the report, sending it an array of the form: “mvname”^/FIRST[“xx.name”] which returns an array containing the positions of all the first fields. This way if someone added or deleted unrelated fields, no MV related logic change needed to be made even in one place.
I would like to simplify this too and just have a call without even initializing the MVs and their first fields, and get back the positions. Unfortunately I’ve been able to do this only if the first fields on lines are also the first fields of the /MV, which isn’t always the case. Is anyone aware of a call I can use to do this?
I would just ditch the /MV array completely and build your own arrays then use ECB/ECE to print them.
Here’s an article that talks about it: https://www.meditech.com/kb/Custform.ASP?urn=33867
Basically you build an array called whatever with values structured however you want it. I’ll often call a macro in my D or START regions to build all my arrays. I always preface my arrays with /X. so it is easier to find and cleanup later. So for example /X.DATA.
Fill that array with data however you would like it. “This is simple”^/X.DATA[1],”Really really simple”^/X.DATA[2]. Then you make a computed field xx.data, VAL=/X.DATA[SUB]. And finally you use the line attributes ECB/ECE to loop through your array and print out the data. ECB=””^SUB,DO{+/X.DATA[SUB]^SUB ., ECE=.},. This line attribute basically inserts code directly into the report, before and after the line you select. So you can loop through your on arrays.
Thanks
~Anthony
Anthony O. Uwadia, PharmD, Automation Staff Pharmacist
Sentara RMH Medical Center | 2010 Health Campus Drive, Harrisonburg, VA 22801
540.689.2345 | 240.245.0456 cell |
aouw...@sentara.com | RMHOnline.com
Get well, Live well
From: Ganesh Seshadri [mailto:gses...@indianarmc.org]
Sent: Wednesday, April 02, 2014 9:02 AM
To: medit...@mtusers.com
Subject: [MT-L] ? MV NPR RW Magic 5.66
I agree that ECB – ECE loop can often be more convenient than MV array. You can have nesting in your temp array and get the headers to be bold, line 1 to be a bar code, etc by wrapping loop around a set of lines.
Joe Cocuzzo
Sr. Vice President
Reporting Services
Iatric Systems, Inc.
Phone/Fax: (978) 805-4115
Iatric Systems helps healthcare providers achieve success by delivering the most comprehensive healthcare IT integration.
From: Meditech-l [mailto:meditech-...@mtusers.com] On Behalf Of ANTHONY O UWADIA
Sent: Wednesday, April 02, 2014 11:44 AM
To: 'Ganesh Seshadri'; medit...@mtusers.com
Subject: Re: [MT-L] ? MV NPR RW Magic 5.66
I would just ditch the /MV array completely and build your own arrays then use ECB/ECE to print them.
Here’s an article that talks about it: https://www.meditech.com/kb/Custform.ASP?urn=33867
Basically you build an array called whatever with values structured however you want it. I’ll often call a macro in my D or START regions to build all my arrays. I always preface my arrays with /X. so it is easier to find and cleanup later. So for example /X.DATA.
Fill that array with data however you would like it. “This is simple”^/X.DATA[1],”Really really simple”^/X.DATA[2]. Then you make a computed field xx.data, VAL=/X.DATA[SUB]. And finally you use the line attributes ECB/ECE to loop through your array and print out the data. ECB=””^SUB,DO{+/X.DATA[SUB]^SUB ., ECE=.},. This line attribute basically inserts code directly into the report, before and after the line you select. So you can loop through your on arrays.
Thanks
~Anthony
Anthony O. Uwadia, PharmD, Automation Staff Pharmacist
Sentara RMH Medical Center | 2010 Health Campus Drive, Harrisonburg, VA 22801
540.689.2345 | 240.245.0456 cell | aouw...@sentara.com | RMHOnline.com
Get well, Live well
From: Ganesh Seshadri [mailto:gses...@indianarmc.org]
Sent: Wednesday, April 02, 2014 9:02 AM
To: medit...@mtusers.com
Subject: [MT-L] ? MV NPR RW Magic 5.66
-------------Disclaimer---------------
Hi Ganesh,
Here are a couple techniques I use to try and simplify MV arrays.
1. When calling the macro that builds the MV pass in both the MV mnemonic and starting field.
e.g. AL D %ABS.PAT.zcus.program.M.detail(urn,"D",9)
Then in the macro you can just refer to the MV as B and the first field as C, with subsequent fields being C+1, etc.
2. On reports where you'll be displaying multiple query responses in MV arrays, first set up something like the following in AL START:
<Field Number>^/MULT.QRY[<Query Mnemonic>]
Then use the query mnemonics as the names of the MV arrays.
In a macro loop through /MULT.QRY and display the responses using the query as the MV, and value of /MULT.QRY as the field.
""^cd.query,
DO{+/MULT.QRY[cd.query]^cd.query...
...<Response>^/MV[cd.query,<Sort>,/MULT.QRY[cd.query]]
Jerry Beals
Holyoke Medical Center
Holyoke, MA
Joe C’s approach is to completely rely on the field name and calculated position versus what you and I did, which was to tie the MV name to its first position, and increment by 1 for each column. His option is more flexible if you add/move the /MV fields but each field name had to be reproduced exactly in the macro, whereas in our technique the MV field names are irrelevant.
I should look more into the ECB approach mentioned by Anthony Uwadia to see where that fits the best too..
Thanks all for your input.
From: Jerry Beals [mailto:Beals...@holyokehealth.com]
Sent: Wednesday, April 02, 2014 2:40 PM
To: Ganesh Seshadri; Meditech L
Subject: Re: [MT-L] ? MV NPR RW Magic 5.66
Hi Ganesh,