For the next series of Techie Tuesday tips, I will be exploring How to Turn the 5 Things You Hate About NPR Report Writing into the 5 Things You Love.
Today’s topic: I don’t understand fragments or how to link across applications
A report fragment is a NPR report used to access information from a different application. A fragment is called from within NPR reports and operates as a “function.” It is passed input values, and returns output to the calling program. Typically, a fragment will return value(s) to be used by the calling program, although it can be used to produce a report picture as well.
- A – Name of the fragment
- B – Database accessed by the fragment
Fragments are useful for crossing applications and gathering data. They can return information from one field to entire lines of report text. Once users understand how to call fragments, fragments are easy to use for applying data from multiple applications into one report. Using Z.rw.fragment checks user access.
To demonstrate the use of a fragment, we will create a report in ADM.PAT which lists in-house patients, and additionally pulls their total charges from BAR.PAT.
When creating a fragment within the NPR editor, a fragment’s report name customarily ends with .frag.
On page two of the report, provide your fragment’s input variables (in this case, /NUMBER) to select record(s).
We will use a line attribute to set the fragment’s output. In this case we are storing the patient’s total charges to /R.FRAG.VAL. The statement ends with “” so that the line will never print.
It is possible for a fragment to have multiple output values.
Ex: Account balance could be stored in /R.FRAG.VAL , etc.
In this master report, written from ADM, the fragment is invoked using a line check (LC). (Fragments may also be invoked from custom fields or macros.)
@acct.number is stored in /NUMBER as our input variable to the fragment. The fragment is called using %Z.rw.fragment.
The fragment’s output, /R.FRAG.VAL is set as the value of the custom field xx.total.chgs.
Next Tuesday we will focus on another tip in the series: How to Turn the 5 Things You Hate About NPR Report Writing into the 5 Things You Love.