Sandbox

From CometWiki

(Difference between revisions)
Jump to: navigation, search
(Removing all content from page)
Line 1: Line 1:
-
'''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:
 
-
 
-
<pre>
 
-
PROMPT %name% length ENTER Program
 
-
or
 
-
PROMPT CAPTION "Caption on prompt dialog"
 
-
or
 
-
PROMPT %name% Length prompt [default]
 
-
</pre>
 
-
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.
 
-
 
-
How about a slight mod for the ENTER option:
 
-
<pre>
 
-
PROMPT %#name% length Program  ! this indicates an ENTER program that has a UI
 
-
PROMPT %#name% Program        ! this indicates an ENTER program that doesn't have a UI (ie silent)
 
-
</pre>
 
-
the # following the % indicates ENTER.  The presence of "length" indicates that the ENTER program will pop up an entry screen and the value selected will be displayed to the user along with all the other prompts.  The absence of "length" says the ENTER program will run silently and will return the value and its length to the Reporter.
 
-
 
-
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:
 
-
 
-
<pre>
 
-
 
-
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
 
-
 
-
</pre>
 
-
 
-
For example:
 
-
<pre>
 
-
PROMPT %printer% 3 Printer name [LP2]
 
-
...
 
-
PRINTER %printer.name%
 
-
</pre>
 
-
 
-
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:
 
-
<pre>
 
-
ENTER %company.name% 2 GETZZCO
 
-
...
 
-
INPUT RECEIVABLES (%company.name%R1)
 
-
</pre>
 
-
 
-
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
 
-
 
-
There is another case where an enter program could be used. That is to fill in the default value in the edit control. The enter program could calculate the default, put up some sort of control, or whatever the developer wants. Here is an example:
 
-
 
-
<pre>
 
-
PROMPT %iStart% 8 Starting invoice date [ENTER GETDATE ]
 
-
</pre>
 
-
 
-
The GETDATE program could put up a date picker. The result would be displayed in the default for the edit control.
 
-
 
-
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).
 

Revision as of 21:18, 12 October 2009

Personal tools