Creating a MEDITECH Data Extract Using a Macro

August 19, 2015 | By Gene Morris
Creating a MEDITECH Data Extract Using a Macro
0

When Gil told me he was going to start a social media Web site for the Meditech-L, I was very excited for him and I wanted to see what I could do to help him wrestle Meditech users away from the old Meditech-L Web site and to his new social media experiment.   He agreed to allow me to publish articles on a regular basis and to let me answer questions you may have about building NPR reports, customer -defined screen attributes, using the report designer, and any other topics that may be of interest to you.  

 

Environment: MEDITECH C/S

Request: Your CFO requested a billing data extract consisting of 100+ fields.  (Note: I won't use 100+ fields in my example for simplicity)

Problem: The main problem you run into in this situation is building the extract using multiple rows on the Meditech report writer picture.  It becomes very cumbersome to insert new fields between existing fields, change the length of an existing field, change the delimiter for the heading (unless you build the headers as custom fields), as well as other issues such as getting the line checks correct.

 

1.       1) Setup page 1 of the report as follows (I'm using the B/AR procedure dictionary for simplicity):


1.       2) Go to the 'Picture' tab.   Notice that the picture doesn't contain any regions (header, detail, or trailer).   




1.       3) Click on the 'Footnotes' tab and add the following:




1.      4) The 'Footnotes' contain two macro calls:

a.       AL START start where 'start' is the name of the macro where we'll build the headers

b.      AL D detail where 'detail' is the name of the macro where we'll download the data

 

 

2.      5) File the report and then  go into '7. Enter/Edit' to build the start macro.     I added comments in the code below to explain what it does.   Take note of the way the code is setup using descriptive local macros at the start (@INIT, @BUILD.HEADERS, and @NEW.ROW) separating out the code so it's organized and easy to read.




1.      6) Next build the 'detail' macro using the code below:




1.       7) After filing the 'start' and 'detail' macros be sure to retranslate the entire report (4. Translate) so the macro code is incorporated into the overall report object code.    Once you've translated the report and no errors exist, you're ready to run the report to extract the data you need.

 



 

I hope you found the example useful.   Please keep in mind that I only used 7 fields in my screen shots for simplicity and so you could see all the code, but in the 'Problem' statement above my reasoning for building out the extract using macros was because the extract contained 100+ fields.  

                              

I look forward to hearing your feedback and to discussing other topics that interest you. 

 

 

Gene is a member of the team at NPRReportWriting.com.  He's a former MEDITECH software developer who has been building NPR Reports and programming  in MEDITECH for over 20 years.   You can reach him at info@nprreportwriting.com.

















Comments:

No comments
You need to sign in to comment

Recent Articles

Most Viewed

Categories