Controlling Print Order

Modified on Thu, Nov 30, 2023 at 10:58 AM

Basics: Turn off print ('V' checkbox in each 'column') for all original data lookup columns.  Use a second set of "print" columns to control the print order.  Use Expressions for those columns you want to print.

Controlling Column Order with Expression Columns 


Expression Columns allow you to finely control the order in which data is placed in actual printed columns from left to right on the screen. Expression columns allow you to separate "data processing" from "print order" in a way that was impossible prior to the introduction of Expressions. The Genesis ReportWriter is based on “Columns”. Columns are not only the vertical strips on a report into which you print information: Columns are the repository for all information used in the creation of a report:

  • Columns contain all data that will be printed
  • Columns contain control information used to sort the report via the Sorting screen.
  • Columns contain the information needed to separate the document into sections via the Sections and Totals screen
  • Columns contain the information that will be placed in Section headers
  • Columns are used to filter the data via the Filters screen.

Before Expressions columns, data was restricted to being in the order it was extracted from the database. Typically, data could only be extracted in a certain relatively fixed order. Expressions frees up this 'data processing' requirement from the 'print data' needs of the report writer.


Why are Data Columns Restricted to a Certain Fixed Order?

 

When extracting data from the database, "Linked Columns" that pull data from other tables than the report's base table, can only link data in using data in the Columns that are already defined - that is Columns above the current Column in the list of Columns. This necessity to have data in a fixed order limits the print order. Using Expression columns, data can be copied from "data columns" that appear in a fixed order to "print columns" that can print in any order.


Data Columns vs. Print Columns

 

A " data Column " is a Column that extracts data directly from the database and is NOT an Expression Column. A data column contains ‘raw’ data pulled from a table in the database. There are two kinds of data Columns, and they are the two types of Columns that have always existed in ReportWriter:

  • Columns that contain a field from the base table of the report.
  • Columns that look up their value from another, linked table.


A "print Column" is exclusively an Expression Column that copies data from a data Column and/or otherwise prepares data to be printed out. A "print Column" is expressly used to print some data onto the actual report.


A "logic Column" is an Expression Column that is not necessarily itself printed out in the actual report. It can be used to otherwise process report data and perhaps acts as a 'flag' that can be used to decide whether or not to print the row, or it can be used to sort the report. Or it can simply be a processing step in preparing the report. Sometimes the questions you want to ask with a ?: operator – or a set of nested ?: operators are so complex that you may want to break them apart and put some of the logic in a separate Column. These columns neither extract data from the database nor are directly printed out: they simply do some interim computation. The result of the computation can be used:

  • As a test in a Filter on the Filters screen
  • As one of the elements of a ?: Conditional operator in another Column
  • As part of what gets formatted for actual printing by another Column


Controlling Print Order - Separating the Data Columns from the Print Column

To use "Print Columns" instead of "data columns" and completely control print order, do the following:

  1. Mark your data columns as "not for printing" by unchecking the "V" (for 'visible') checkbox for each and clicking Save:

  1. Create an Expression Column for each of the Columns you wish to print. Create these in the order you want to actually print the data. (You can adjust the column order later if you mess up the order):

  1. To simply copy a data Column into a print Column all you need to do is use an Expression that simply pulls in the other Column:

A screenshot of a computer

Description automatically generated

Figure 1 - Expressions for copying columns are listed on the left on the Define Linked Column screen


For example, if you want to print the student's ID in a print Column, if the data Column is named 'studentID' your expression would be: ${row.studentID}. Embedding the name of a column in an Expression simply copies the other Column's contents.

 

  1. You can also add processing to the print Column to ensure that the data prints in the desired way.
  • E.g. To print a student's name in "initial capitals" format, use the "initCaps" function: ${rw:initCaps(row.studentName)}
  • E.g. To print an Email Address all in lower case, use the toLowerCase format function: ${rw:toLowerCase(row.emailAddr)
  • E.g. to format a date (e.g. student’s birthdate), use the ‘rw:formatDate’ function:

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article