IPeople Blog

How to Access NPR Segments that are not available as Detail Segments

Written by Gary | Nov 3, 2021 5:00:00 AM

Sometimes MEDITECH does not make a segment available as a Detail Segment in their NPR Report Writer. The NPR Segments are stored in their own DPM called NPR.SEG. There is a field attached to each segment called cust.rw.access which determines whether or not the segment will be available as a Detail Segment.

We can still access these segments but in a less user-friendly manner. Here is an example showing how to print out a list of all of these segments. They come from a DPM called NPR.SEG:

1) Create a report with Report DPM NPR.SEG (Do not select a Detail DPM, Detail Segment, Index DPM, or Index File)
2) Add the following Line Attributes to your Detail Line:

ECB=""^dpm,
ECB=DO{@Next(dpm) ""^name,
ECB=DO{@Next(name) IF{"Y"'=@cust.rw.access 1,
ECE=1}}},

3) Create two fields with the following attributes and put them on your Detail Line:

xx.dpm
DAT=FREE
LEN=30
VAL=dpm
 
xx.name
DAT=FREE
LEN=30
VAL=name

4) File and translate your report. It is now ready to be run.

ECB is a Line Attribute that stands for Extra Code Beginning. It allows users to run whatever code they like before the current line begins printing. ECE stands for Extra Code Ending and allows code to be run after the current line finishes printing.

In this case, the ECB performs what is called a DO Loop through the Subscripts of the segment. This particular segment has two subscripts: DPM and name. Also, an IF statement is performed so that only those records whose cust.rw.access field is not equal to "Y" are included on the report.