Example Code

Printing a Multi-page Table in a Standard Report using Report Generation Toolkit for LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW Report Generation Toolkit
  • LabVIEW

Code and Documents

Attachment

Overview
This VI illustrates how to append a multi-page table to a Standard Report.


Description
In this example, a Standard Report is used to generate and print a report.  The problem addressed was how to use the "Append Table to Report.vi" on a large table, especially one with a lot of columns.  The standard behavior of the "Append Table to Report.vi" is to cram all the columns of the input table onto one page, regardless of its size. 

So this example shows how to print the large table on multiple pages, with each page containing a specified number of columns.  To accomplish this, the idea is to divide the table columns from the table between all the different pages, and call the "Append Table to Report.vi" on each subset of table columns. 

 

The input to the "N" terminal of the for loop is the number of subsets that will be printed on separate pages.  The increment logic is needed when the columns don't divide evenly between all the pages, and so an extra page is used to print all the spare columns.  

 

NOTE: The logic could also be replaced with the "Divide" and "Round Toward +Infinity" VIs. 

Inside the for loop, the "Array Subset" VIs use the current loop count and the "N" input to select the appropriate columns in the table to append to the Report, using the "Apend Table to Report.vi".

The case statement is used to add the page breaks so each table subset will print on separate tables.  

NOTE: The "Append Table to Report.vi" has an input titled "separate page?" which causes the table to be printed on a separate page, but the page break it adds to the report is after the table is added.  To work correctly, the page break needed to be before the table is appended to the report.  This also made it easier to have text appear on the same page as the table, as in this example, the last page had a signature line added.

The rest of the VI contains code for creating the Standard Report, page and text formatting, and printing.  This code is not discussed because it is beyond the scope of this example.

NOTE: When you run this example, it WILL PRINT THE REPORT.

 
Requirements

  • LabVIEW Full Development System 2012 (or compatible)
  • Report Generation Toolkit


Steps to Implement or Execute Code

  1. Unzip the attached folder to your computer.
  2. Open the VI "Multipage Report 2012 NIVerified.vi".
  3. Run the VI.

 

Additional Information or References
VI Block Diagram

キャプチャ.PNG

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Systems Engineer
SISU

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
FabriciusLopes
Member
Member
on

Excellent ! A few months ago i had this same problem and your idea fits like a charm for me.