Sandbox

From CometWiki

(Difference between revisions)
Jump to: navigation, search
m (playing)
m (playing)
Line 5: Line 5:
Syntax:
Syntax:
 +
<pre>
PROMPT %name% Length prompt [default]
PROMPT %name% Length prompt [default]
-
 
+
</pre>
Where  
Where  
*name is any series of characters in the report surrounded by % that should be substituted with the prompt value
*name is any series of characters in the report surrounded by % that should be substituted with the prompt value

Revision as of 20:06, 26 August 2009

Reporter Prompt Statement

The reporter will build a dialog box for the user to enter any values specified in all of the prompt statements in a report spec.

Syntax:

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
  • length is the length of the string substitution value
  • prompt is the text to display in the prompt dialog
  • default is the default value to be used in the dialog edit box

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 [01/01/04]
PROMPT %iEnd% 8 Ending invoice date
PROMPT %company% 2 ENTER 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).