CHUI custom reports made easy.

  Author: Bernardo Gomez. Emory University.

Revised: November 1, 2004.

Motivation:


If you are still building custom reports for the telnet-based UNICORN, you could save effort when creating prompt scripts for added_selections. I will show you how.

Problem:


UNICORN doesn't allow the definition of custom dictionaries under CHUI. That is, we can't use Unicorn/Rptcustom/Tools/Sel to reuse UNICORN's shell scripts associated with dictionary entries.

Example:


I would like to have an added_selection in the following Unicorn/Rptcustom/Prompts/Bgtest/directives file:
###
phase="titling selection "
echophase="${phase}"
selection="hold item"
added_selection="example"
dictionary=""
selexamplereqfilter="i|12|"
###
The added_selection is named "example". example would prompt for a number and for a list of names.
BGTEST REPORT               Example Selection Phase                  11/01/2004

Currently no example characteristics will affect the records included in
the finished report.
  * Name List : *** ANSWER REQUIRED ***

          (To return to previous level, press the ESCAPE key .)
-------------------------------------------------------------------------------
Include records based on the selected example characteristic:

   1) Name List
   2) Number

Type       HELP for help,
           NEXT to go to the next selection,
  or   a NUMBER.

[NEXT]

Solution:


As usual, example would require three files:
example.sel , example.ech, example.dsp . example.sel would normally require writing a complicated K-shell script.

Here's the simplified example.sel:

selexampleopt13="selexample|13|Fiscal Cycle|numbers|-d||"
selexampleopt12="selexample|12|Transit Reason|anyname||namelist='HOLD:HOLD ; BOOKING:BOOKING '|"
selexamplename12="Name List"
selexamplename13="Number"
selexamplesetlist=" 12 13 "
selectdb=selexample
selexampleoptions="'Name List|12' 'Number|13'"
do_selexampledata0="Y"
. `gpn rptscript`/Promptsubs/select
###
Here's the simplified example.dsp:
selexampleopt13="selexample|13|Fiscal Cycle|numbers|-d||"
selexampleopt12="selexample|12|Transit Reason|anyname||namelist='HOLD:HOLD ; BOOKING:BOOKING '|"
selexamplename12="Name List"
selexamplename13="Number"
selexamplesetlist=" 12 13 "
selectdb=selexample
selexampleoptions="'Name List|12' 'Number|13'"
do_selexampledata0="Y"
. `gpn rptscript`/Displays/select
###
Here's the simplified example.ech:
selexampleopt13="selexample|13|Fiscal Cycle|numbers|-d||"
selexampleopt12="selexample|12|Transit Reason|anyname||namelist='HOLD:HOLD ; BOOKING:BOOKING '|"
selexamplename12="Name List"
selexamplename13="Number"
selexamplesetlist=" 12 13 "
selectdb=selexample
selexampleoptions="'Name List|12' 'Number|13'"
do_selexampledata0="Y"
. `gpn rptscript`/Echoes/select
###

Notice that selexampleopt13 and selexampleopt12 are using two UNICORN shell scripts: "numbers" and "anyname".

In example.sel , example.ech, example.dsp, I am emulating the rpt_init tool.

UNICORN report initialization routine v2002 started on Monday, November 1, 2004, 4:04 PM
  Report_init parses the report dictionaries and set files for the reporting
   system and outputs the shell script variables to standard output.
  -d the list of dictionaries to parse.  The list can be comma seperated or
     space seperated.
  -f process the filters.  The file given has in it all the variables created
     by the directives file.  Only interested in the filter variables and their
     values for filters belonging to the dictionaries selected with -d.  If
     this option is not used, calls to rpt_filter are sent via standard output.
     This option is disabled when -r is used.  The format of this file is:
         selvendorpromptfilter=i|4|5|
     Do not use quotes arround the variable value(s).
  -r the output is to be formated for run side initialization instead of for
     the prompt side (default is prompt side).
  -s the set file to use to create the shell variables from.  The full path and
     file name is required.
  -v the variables to perform meta char fixes on.  Currently only '\p' -> '|'.
**Invalid argument -x
UNICORN report initialization routine finished on Monday, November 1, 2004, 4:04 PM

Notice also that in directives I have made "Name list" option required:
selexamplereqfilter="i|12|"

Major Caveat:


The default.set now has two entries:
selexample|12|||
selexample|13|||

This means that when writing the GUI corresponding custom report, you would need to define Unicorn/Rptcustom/Prompts.u98/Bgtest/directives as:

phase||titling,added_selection|
echophase||phase|
added_selection||selexample|  ## <===<== selexample