|
| Monday, 01 June 2009 07:00 |
Tricks of the Trade: Use a File as Selection Criteria for Your Report (Client Server)By: John Sharpe, President, Comstock Software, Inc. Remember our BAR report? The one where we used the List Builder to build the list of /ACCOUNTS, instead of hand-keying each account into the run time SELECT Prompt? For a once-in-a-while report, that is a fine solution. But what if someone without programming experience at the business office wants an ad-hoc report for a large number of accounts on a regular basis? There is always another way. For this scenario, you'll use the contents of a text file as the SELECTION CRITERIA. This file will be stored on a file server (shared drive) where MEDITECH and the person at the business office can both access it. For our purposes, the file path will be \\APOLLO-1\MT$\BAR\RAC\Accounts.txt. Whenever the business user wants a report for a batch of accounts, they will: 1) update this file using a text editor like Notepad; and 2) run the report and print to DOWNLOAD. If you need any assistance with choosing an appropriate location and coordinating mapped drive access for your business user, a good place to start is to contact your network or systems administrator. Let's review the report's layout; and then, update our AL START macro. Here’s a quick overview of the NPR setup. NPR Report Writer - Page 1 - Setup: NPR Report Writer - Page 2 - Setup: NPR Report Writer - Footnotes - Setup: Instead of using a SELECT Prompt of ‘Accounts:’ and entering the accounts 1 by 1 at report run time, we’ll populate the /ACCOUNTS list by reading from the text file. NPR Report Writer - Start Macro - Setup: To get the complete macro, download it here. By using this method to populate the /ACCOUNTS array; the list could easily scale from 10 to 5000 accounts without additional effort on the part of the NPR Report Writer. NPR Report Writer - Page 3 - Setup: This report is built in a DOWNLOAD format, which means you can print to the printer named DOWNLOAD. Printing to DOWNLOAD allows you to save the file with a .CSV file extension. Microsoft Excel is a great application for opening and analyzing files in the .CSV file format.
Thoughts or Questions? Email them to John at jsharpe@comstock-software.com. John Sharpe is President / NPR Consultant at Comstock Software, Inc. Learn more about NPR Report Writing at the MEDITECH NPR Report Writing Blog. |
MeditechBulletin.com and MeditechCareers.com are not affiliated with MEDITECH, Inc.













