Unit 11 Creating Basic Totals1

Sort Trailers

The TRAILER prompt requires a "Y" or "N" response. If "Y" is selected at this

prompt, a TKn region is set up on the report picture. Again, the n refers to

the sort field number. This region prints once for each value of the sort field and is used for subtotaling records based on the sort field value. "N" is the default value at this prompt.

Z.count

The special field Z.count is used to count the number of detail records which met the select criteria of the report. This field is entered in the fields sections on Page 3 of

the Report Writer. Z.count produces a field marker of count.

Z.count can only be used in TKn and TR regions. Place Z.count on the TKn and/or TR region to produce a subtotal count and/or grand total count of detail records. If a child segment is used as a detail segment, the count is based on the number of child segment records which meet the select criteria. This example uses the main segment of the ADM.PAT DPM and therefore produces a count of patients. The TK1 region is associated with the sort field location. Placing the Z.count on the TK1 will produce a count of patients per location. Placing the Z.count on the TR region will produce a count of patients for the entire report.

You can only generate a total for a data field which has a numeric data type.

Placing a standard numeric data field in a trailer region will automatically produce a total sum of the field's value.

You can place the field in a trailer key region (TKn) to generate a subtotal based on a sort value. You can place the field in a report trailer region (TR) to generate a grand total for the entire report.

The data field length.of.stay has a data type of PINT means this field stores an integer value. This allows us to generate a subtotal if we place this data field in a TKn region and a grand total if we place the data field in a TR region.

The example report above has a trailer key region based on the location sort field. The trailer key region will print after the patient information for each location. By placing the data field length.of.stayin the TK1 region, the report writer will automatically keep a sum of the length.of.stay values for each patient's detail record and produce a subtotal for each location. The data field length.of.stay canalso be placedin the TR region to produce a grand total of the length.of.stay values for all patients included on the report.

Considerations When Totaling Values

1. Only fields with a numeric data type can produce a total.

2. The field can be placed anywhere in a TKn and/or TR region.

3. A summary report can be created by suppressing the Detail region from printing and only printing Trailer regions.

4. A field does not have to appear in the Detail region in order to print a total of the field's value. Simply place the field in the desired trailer region.

Workshop - Part D:
  • Print the total number of patients for each facility, each location, and report.
  • Print the total length of stay for each facility, each location, and report.

MEDITECH

Level One - NPR Report Writer Workshop