Sandbox

From CometWiki

(Difference between revisions)
Jump to: navigation, search
m (minor)
m (minor)
Line 35: Line 35:
PROMPT %iStart% 8 Starting invoice date [ENTER GETDATE ]
PROMPT %iStart% 8 Starting invoice date [ENTER GETDATE ]
PROMPT %iEnd% 8 Ending invoice date [ENTER GETDATE]
PROMPT %iEnd% 8 Ending invoice date [ENTER GETDATE]
-
ENTER %company% 2 ENTER GETZZCO
+
ENTER %company% 2 GETZZCO
INPUT RECEIVABLES (%company%R1)
INPUT RECEIVABLES (%company%R1)
TITLE RECEIVABLES FOR CUSTOMERS %cstart% TO %cend%
TITLE RECEIVABLES FOR CUSTOMERS %cstart% TO %cend%

Revision as of 18:34, 27 August 2009

Reporter Prompt Statement

The reporter builds a dialog box for the user to enter the values specified in all of the prompt statements in a report spec. Then, for this report and all subsequent reports, the prompt values will be substituted where specified.

Syntax:

PROMPT %name% length ENTER Program 
or
PROMPT CAPTION "Caption on prompt dialog"
or
PROMPT %name% Length prompt [default]

Where

  • name is any series of characters in the report surrounded by % that should be substituted with the prompt value. The name must appear in the Prompt statement and is case insensitive.
  • length is the length of the string substitution value. The length specification must appear in the Prompt statement.
  • prompt is the text to display in the prompt dialog. The prompt specification must appear in the Prompt statement. Prompts may be surrounded with quotes. The double/single quote rule applies as IB string constants.
  • default is the default value to be used in the dialog edit box. The default specification may appear in the Prompt statement. If so, it must be surrounded with square brackets.


For some developers, Steve Auerbach's REPRPL pre-processor for the Reporter has become a valuable tool for providing the user a way to supply report-specific data values at runtime. We propose incorporating this ability into the Reporter itself and at the same time providing some additional flexibility.

Here's an example of a report incorporating the Prompt statement:


PROMPT caption "This string will appear as the caption of the prompt entry dialog"
PROMPT %printer% 3 Printer name [LP2]
PROMPT %cStart% 6 Starting customer number
PROMPT %cEnd% 6 Ending customer number
PROMPT %iStart% 8 Starting invoice date [ENTER GETDATE ]
PROMPT %iEnd% 8 Ending invoice date [ENTER GETDATE]
ENTER %company% 2 GETZZCO
INPUT RECEIVABLES (%company%R1)
TITLE RECEIVABLES FOR CUSTOMERS %cstart% TO %cend%
TITLE WITH INVOICES DATES BETWEEN %istart% TO %iend%
PRINTER %printer%
KEYRANGE "%cstart%" TO "%cend%"
REPORT
DEFINE STINV.DATE.SEQ = DATE2NUM("%istart%",0);6.0
DEFINE ENINV.DATE.SEQ = DATE2NUM("%iend%",0);6.0
SELECTING IF AR.DATE.SEQ GE STINV.DATE.SEQ AND
             AR.DATE.SEQ LE ENINV.DATE.SEQ
USING R1.TO.C1A (%company%C1A)
PRINT YADA, YADA, YADA

For example:

PROMPT %printer% 3 Printer name [LP2]
...
PRINTER %printer.name%

We would also support the option that allows for specification of a subprogram that would be ENTERed to provide the string replacement value. We would allow for multiple of these just by including a name or number within the % signs such as:

PROMPT %company.name% 2 ENTER GETZZCO
...
INPUT RECEIVABLES (%company.name%R1)

Now you can see the reason for the trailing "%". In the above example you want the final INPUT statement to look something like:

INPUT RECEIVABLES (MAR1)  ! the "MA" was supplied by the subprogram

Use of the trailing % allows for string substitution to be done within another string. Here's another example:

KEYRANGE "ABC%product%-00001" TO "ABC%product%-99999" could become KEYRANGE "ABC12345-00001" TO "ABC12345-99999" the user only needed to enter the "12345" portion of the string replacement.

PROMPT statements should be defined at the top of a report. PROMPTs need not be only for the current report. If the report runs another report in the same parition that requires string replacement the PROMPTs for all reports in the series can be placed at the top of the first report.

At runtime, the user will be prompted for all values defined by PROMPT statements. The responses will be written to the #CPROMPT file on TMP. This file is keyed by PARTITION$ + PROMPT name. Such as:

P00%5% P00%product% P00%#company.name%

As the report spec is interpreted, string fields will be parsed for a %..% pair. If found, the #CPROMPT file will be read to see if there is a replacement defined for the %..% value. If not found, the string will be used as is (thus allowing for data to actually contain % signs).