Integrate spool files seamlessly into your apps

Integrate spool files seamlessly into your apps
rswanson
Mon, 01/23/2023 – 15:31

Posted on January 23, 2023

Every IBM i system generates spool files in one way or another. From job logs and compile listings to old-school inventory lists and sales reports, spool files can be quite prevalent. Many companies use tools to convert their spool files into PDFs that can be easily emailed or displayed, and Valence is no exception. The Spool File Viewer app included with Valence makes it easy for users to list spool files and download them in PDF form.

But did you know you can also bring Spool File Viewer functionality directly into your Nitro App Builder-developed apps? This makes it possible to conveniently show specific spool files without users having to leave the app to find and view the documents generated by their actions.

Introduced in Valence build 6.1.20221219.0, the Spool File Viewer is accessed within NAB Designer as a utility widget. This means you bring it into your app by clicking on “Add Widget”, then click the “Utility Widgets” button, then select “Spool File Viewer” as depicted here:

In order for the desired spool file to be shown in your app, you must supply the viewer widget with pertinent spool file attributes using app variables. The values required are:

The name of the spool file
The spool file number
The name of the job that created the spool file
The user of the job that created the spool file
The job number that created the spool file

In cases where you’d like the spool file to occupy the full screen within your app, you may find it easiest to place the Spool File Viewer widget in its own section, then show that section once the required app variables have been populated.

The app variables feeding the spool file viewer may come from the front-end, such as a clicked row in a grid widget, or from a back-end RPG program that has been called through a front-end action, like a button click. The latter scenario is most applicable for calls to programs that create spool files which you’d like to display in-line to the user. In such cases, your back-end RPG program should set the app variables with the pertinent values once the spool file has been created. This is done using the SetAppVar() NAB helper program procedure, as depicted in EXNABBTN.

Note that in the next Valence maintenance build, expected to be released in mid February 2023, the app variable holding the spool file number can be hard-coded to a value of *LAST to retrieve the last applicable spool file generated by the job having a matching spool file name.

By default, the spool file viewer will show the spool file as inline text using a uniform size font. If you’d prefer to see the spool file as a PDF (available when running in Desktop only), click on the widget’s Settings and click the “View as PDF” checkbox.

To see the Spool File Viewer widget being put to use in live action, be sure to catch the upcoming Developer Diaries episode on February 9. Click here to set a calendar reminder.

CategoryTip of the Month

Leave a Reply

Generated by Feedzy