[MT-L] ? MV NPR RW Magic 5.66

50 views
Skip to first unread message

Ganesh Seshadri

unread,
Apr 2, 2014, 9:01:50 AM4/2/14
to medit...@mtusers.com

I have a question about best practices for creating reports with MV arrays.  Is anyone aware of either a Meditech routine or something they’ve written that will automatically populate an array with the starting field positions of all the MVs in a report so that these variables can be used in the logic, and not worry about fields unrelated to the MVs being added and changing the positions?

 

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?  

 

Ganesh Seshadri

Analyst

Indiana Regional Medical Center

(724) 357-7012

Joe Cocuzzo

unread,
Apr 2, 2014, 9:17:09 AM4/2/14
to Ganesh Seshadri, medit...@mtusers.com
We have a report in our report library Z.zcus.is.rw.util and if you call %Z.zcus.is.rw.util.M.field("") the macro will take the report name from /R.NEW.PAGE.PGM and make an array of all computed fields /FLD["xx.field"] = field number.

Add this to a START macro

AL START %Z.zcus.is.rw.util.M.field("")

and then create your MV arrays like this:

(Magic) DATA^/MV["D",SORT.VALUE,/FLD["xx.mv.field"]]

(C/S) DATA^/R.MV["D",SORT.VALUE,/FLD["xx.mv.field"]]

Most customers of ours will already have Z.zcus.is.rw.util in their systems. Some versions use the A argument as the report if it is passed in instead of /R.NEW.PAGE.PGM value. The version in the library does not.

If you call an NPR.REP fragment you can do the same thing, the big disadvantage is that you have to give the run user * access to NPR otherwise the fragment won't run.

The library search page is here, search for "Z" dpm reports for your platform (Ganesh is magic, but we have it for C/S also).

http://www.iatric.com/Information/NPRReportLibrarySearch.aspx

This approach will not work if you are using an MV array in a fragment, because a fragment calls the new page program of the main report (or in the case of MAR and label fragments, the new page program is a generic new page procedure written by Meditech). The solution is to take the code from Z.zcus.is.rw.util.M.field and hardcode the name of the fragment instead of using /R.NEW.PAGE.PGM for the report name.

Other than the fragment issue, if you use the utility to get field numbers, you won't break an MV array by adding, removing or rearranging fields. I find it helpful to give my MV field short names that I can remember when I get to the macro:

Like this: xx.mv1 xx.mv2 or: xx.lab xx.drug xx.al xx.adr
Joe Cocuzzo
Sr. Vice President
Reporting Services
Iatric Systems, Inc.
Phone/Fax: (978) 805-4115
Email: mailto:Joe.C...@iatric.com
Web: http://www.iatric.com/

Iatric Systems helps healthcare providers achieve success by delivering the most comprehensive healthcare IT integration.
__________



===###===###===###===###===###===###===
To unsubscribe from the meditech-l, follow the instructions at the URL http://mtusers.com/mailman/options/meditech-l_mtusers.com/

Please do NOT send messages that ask "Please post to the list" or "I'd like to see your answers" or "Send that info to me, too" These are useless messages that just waste the email server's resources. Instead, email the original requester and ask that they send you or post the results of their question.

Go to http://MTUsers.net for other information on the list, as well as:
1) reading meditech-l messages online
2) job opportunities
3) vendor products and service


Do NOT send email to meditech...@MTUsers.com. This is a system email box that is NOT monitored by a human. If you need help or advice on how to use the meditech-l, email ju...@MTUsers.net. Julia helps manage the meditech-l, so she is your best resource.

===***===***===***===***===***===***===

Ganesh Seshadri

unread,
Apr 2, 2014, 9:38:35 AM4/2/14
to Joe Cocuzzo, medit...@mtusers.com
This makes sense - it's so much simpler to make the MV positions referenced by the name of the first field as you are, versus the way I was doing it - basing the position on the MV name. ie., /FLD["xx.1"],/FLD["xx.1"]+1, etc versus what I was doing /POS["mvname"], /POS["mvname"]+1, etc. because /FLD[xx.1] is so much more straightforward to calculate than /POS[mv1]
Thanks - I'll begin to use this convention..

Ganesh Seshadri
Analyst
Indiana Regional Medical Center
(724) 357-7012

Joe Cocuzzo

unread,
Apr 2, 2014, 9:44:07 AM4/2/14
to Ganesh Seshadri, medit...@mtusers.com
I do not add to create offset, I code /FLD["xx.field"] to get the field number for each MV array.

So if you had two mv arrays like this:


D xx.mv.one
Joe Cocuzzo
Sr. Vice President
Reporting Services
Iatric Systems, Inc.
Phone/Fax: (978) 805-4115
Email: mailto:Joe.C...@iatric.com
Web: http://www.iatric.com/

Iatric Systems helps healthcare providers achieve success by delivering the most comprehensive healthcare IT integration.
__________
__________ xx.mv.two____
D xx.mv.one__________ xx.mv.two____


My code to load the two columns would look like this:

Load entry into first column
DATA^/MV["D",CNT+1^CNT,/FLD["xx.mv.one"]]

Load entry into second column
DATA^/MV["D",CNT2+1^CNT2,/FLD["xx.mv.two"]]

Otherwise if there was an edit that inserted a field or a column using an offset from xx.mv.one might not continue to work.

Joe Cocuzzo

unread,
Apr 2, 2014, 9:57:41 AM4/2/14
to Joe Cocuzzo, Ganesh Seshadri, medit...@mtusers.com
We have software that inserts our signatures, logo (for HTML email) and a tag line in outbound email.
Apparently a simple text message with a representation of two MV arrays in a report picture confuses the software and my signature stuff got pasted into the middle of the message. Sorry for the garbled post, it apparently sees a bunch of underscores and decides that the rest of the text in the email is a forward. My point was that in MV arrays, I code using /FLD["xx.field"] for each column and I do not do /FLD["xx.field"] + 1 to calculate from the prior (left hand) column to the next column as that is a more fragile method and not really any time savings in coding either.




Joe Cocuzzo
Sr. Vice President
Reporting Services
Iatric Systems, Inc.
Phone/Fax: (978) 805-4115
Email: mailto:Joe.C...@iatric.com
Web: http://www.iatric.com/

Iatric Systems helps healthcare providers achieve success by delivering the most comprehensive healthcare IT integration.
__________

ANTHONY O UWADIA

unread,
Apr 2, 2014, 11:43:42 AM4/2/14
to Ganesh Seshadri, medit...@mtusers.com

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---------------

This electronic message and its contents and attachments contain information from Sentara Healthcare and is confidential or otherwise protected from disclosure. The information is intended to be for the addressee only.

If you are not the addressee, any disclosure, copy, distribution or use of the contents of this message is prohibited. If you have received this electronic message in error, please notify us immediately and destroy the original message and all copies.

Joe Cocuzzo

unread,
Apr 2, 2014, 2:31:38 PM4/2/14
to ANTHONY O UWADIA, Ganesh Seshadri, medit...@mtusers.com

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---------------

Jerry Beals

unread,
Apr 2, 2014, 2:39:31 PM4/2/14
to gses...@indianarmc.org, Meditech L

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


CONFIDENTIALITY NOTICE: This email communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents is prohibited. If you have received this communication in error, please reply to the sender immediately and destroy all copies of this communication and any attachments.

Ganesh Seshadri

unread,
Apr 2, 2014, 3:37:12 PM4/2/14
to Jerry Beals, Meditech L

Jerry: I have done something very similar to what you describe, except I would let the system calculate field C in your option 1 as well as populate the field^/qry[mnem] in your 2) using NPR.REP in AL START rather than me entering them.  

 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.

Ganesh Seshadri

Analyst

Indiana Regional Medical Center

(724) 357-7012

 

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,

Reply all
Reply to author
Forward
0 new messages