Blogs Home
Monday, September 19, 2011 10:12 AM

NPR Tip: An Index for B/AR Comments (Client/Server or MAGIC)

Written by Joe Cocuzzo, Senior VP of Report Writing Services - iatricSystems

One shortcoming of the MEDITECH HCIS is the lack of a complete activity index in B/AR. There is an activity index that includes all financial transactions (purged with batches in MAGIC, purged at 10 days in Client/Server), but this index does not include an entry for B/AR comments.

Many hospitals want to run productivity reports from B/AR to track the number of comments entered for a date range. Because comments are not indexed directly, you would typically run a report through all B/AR transactions to gather this information (or perhaps make an assumption about the oldest service date of interest and use that as a starting point).

Recently, it occurred to me that the somewhat new HIPAA related user activity tracking could be exploited to serve as a kind of activity index, making a report to find comments for a date range much more efficient. Several years ago, MEDITECH started tracking user activity in all applications at the patient level, so checking the accounts accessed from the B/AR database for a date range is an efficient way to find comments for a date range.

The process is as follows:

Since B/AR comments can only be entered via a B/AR routine, the activity of interest is in the B/AR user activity log, kept (in MAGIC) on the B/AR segment.

  1. Loop through the activity index and make a list of all accounts accessed for the date range
  2. Look at those accounts and select comment transactions with a date in the date range

In a start macro, we loop through the user activity as follows:

NPR Tip 1 image

The report is written in the transactions segment with no index, but an LI selection on /ACCT.

NPR Tip 2 image

We don't want detail on the report, just a count of accounts and comments for each user.

The count of comments is done with @Z.count.

The count of accounts is done with a computed field that includes a "WITH=TK2" attribute and a "FNC" of TOT.

To avoid printing a line per account, we put an LC="" attribute on the TK2 line:

NPR Tip 3 image
NPR Tip 4 image

The complete list of attributes for xx.accts computed field is:







Running this report for a day takes just a few minutes, instead of the many hours it would take to loop through all of BAR.PAT at the transaction level if we did not exploit the user activity index.

NPR Tip 5 image

Note that you would not be able to find comments entered prior to the purge of user activity. That value is in @MIS.PARAM.user.logs.purge.delay. You could check the user selection range with an FCL:

NPR Tip 6 image

NPR Tip 7 image

The code for the MAGIC and the Client/Server versions of this report is identical (except for the segment name on page 1/general tab). An example report written for each platform has been uploaded to our report library:

You can find additional NPR Tips on our website at, as well as information about our on-site NPR Report Writer Training and NPR Report Writing Services.

Upcoming NPR Training Opportunities:

We are pleased to offer NPR Report Writer training sessions at host sites. Details and a course description are available on our website at

Location Level Instructor Date Cost
Greater Baltimore Medical Center
Baltimore, MD
Intermediate / Advanced Philip Sherry October 10-12, 2011 $750

To subscribe for email notifications for new classes, please follow this link:

For more information or to reserve a seat, please contact our NPR report writing team at

(This article originally appeared in the September 2011 issue of Iatric Systems’ Updates! newsletter.)