Related Information Examples & Tutorials

Prompt For Data In A Report

Collect!'s report writer enables you to query the user for data while running a report. The information entered by the user is then used by the report to complete the next steps. This may be used to apply a filter to the data processed in the report. The report gives different results depending on the data the user enters in response to the Prompt. For example, Date range, Operators, Dollar amounts, Transaction codes, Status codes and more can be specified through a prompt. Several examples are given below.

You can also mask data entered when a prompt is presented to the user. This is useful for example, when a manager needs to enter an authentication code to complete a process. You can mask the code entered to hide it from the operator while enabling them to carry on to the next step. Please see examples following.

Prompt For Data Entry

The Prompt command is simply a question mark, ?.

The question mark is used with WHERE clauses and VARIABLES. This causes the report to pause before printing. A dialog box displays asking the user for a value to use to filter the report's data. For example, WHERE @de.na = ? will allow the user to type in a value.

WHERE ({field_code} = ?)

Example:
WHERE (@de.sta = ?)

Top of page.

Prompt With A Variable

@varInput* = ? Enter a value

The words following the question mark appear in the prompt to give the end user directions.


Prompt displays your words to the user

The value entered by the end user fills the variable, in this example, @varInput, and then it can be used in the report later on.

Example:
@de no total WHERE ( @de.u1 = @varInput )
@de.na
@de

When using a variable to obtain data, be sure to assign the correct data type to the variable first! In the example below, the variable @tvarOwing is initialized as currency with the $ symbol.

For example:

@tvarOwing$ = 0.00
@tvarOwing = ? Enter the minimum Debtor's Owing Amount

@cl.de no total WHERE (@de.sta = ACT) WHERE (@de.ow > @tvarOwing)
@de.na @de.fi
@cl.de

The data type determines the number of digits and/or characters that may be entered in the prompt.

Currency: 15
Integer: 9
String: 63
Percentage: 8
Date: 10

Top of page.

Prompt With Variable String

As well as a literal string, shown in the previous example, you can also use a variable or a field value when presenting the prompt to the end user.

Example 1:

@varPrompt* = " "
@varPrompt = "Please enter the Delinquency Date" if ( @de.sta = DLQ )
@varPrompt ="Please enter the Listed Date" if ( @de.sta = NEW )
@varMessage* = ? @varPrompt

When this Prompt is displayed requesting input from the end user, the message they see will depend on the Debtor's Status code.

If the Debtor's Status is DLQ, then the message will say "Please enter the Delinquency Date" but if the Debtor's Status is NEW, the message will say "Please enter the Listed Date."

Example 2:

@varMessage* = ? @de.na

When this Prompt is displayed requesting input from the end user, the message the Debtor's Name will be displayed as the message.

As mentioned before, when using a variable to obtain data, be sure to assign the correct data type to the variable. The data type determines the number of digits and/or characters that may be entered in the prompt.

Top of page.

Prompt For A Range

You can also present more than one prompt to the end user, if you want to specify a range of data for your report.

Here is an example for a range of Operators:

Example:
@varFrom* = ? Enter an Operator to start with.
@varTo* = ? Enter an Operator to finish with.

And this is how you might use it in a report,

To filter the Operator list:

@op no total WHERE ( @op.id = @varFrom .. @varTo )
@op.na
@op

To filter the Contacts list:

@co no total WHERE ( @co.co = @varFrom .. @varTo )
@co.co @co.ty @co.dda
@co

Top of page.

Prompt For A Date Range

When you prompt using a field that is a Date, Collect! will display the Calendar so that you can select a Date Range.

Example:
@de WHERE (@de.li = ?)
@de

When this code runs, a form will display prompting the user for a Date Range. The form title will change depending on your field_code. In the above example, a form named "Debtor Listed Range" will display.


Prompt displays the Calendar when a Date field is used

tip.gif Whenever a prompt (?) is used with a Date field, the user will be prompted to enter a Date Range. The values entered are stored in the database as " Transaction Summary Report.From" and "Transaction Summary Report.To". These values are called by the report if you use their codes, @tsr.fr and @tsr.to.

Example:
@de no total where ( @de.li = @tsr.fr .. @tsr.to )
@de.li @de.na
@de

The values for @tsr.fr and @tsr.to stay set until they are changed by another prompt for a date range. This means that you can reference these dates in your code as above. The result will be a Date Range that is identical to the range you set earlier when the Prompt displayed.

Top of page.

Prompt For Range Of Transaction Posted Dates

This prompts for a Posted Date range from transactions. The user can enter a date in the From and To fields when the Prompt box is displayed.

Example:
@tr WHERE (@tr.pda = ?) MAX = 1
@tr

To use these results in a report, you can use codes that Collect! reserves for holding the date values in a range.

@tsr.fr is used to hold the date value"From".

@tsr.to is used to hold the date value "To".

In the report body, this would look like:

List of All Transactions Created From @tsr.fr To @tsr.to

@tr WHERE (@tr.pda = @tsr.fr .. @tsr.to)
@tr.de<40> @tr.pda @tr.pd @tr.tu>12> @tr.di>12>
@tr

If the user entered April 1, 2011 in the From value and April 30, 2011 in the To value, this report snippet would display a list of transactions in this date range with a Report heading.

"List of All Transactions Created From April 1, 2011 To April 30, 2011"

This particular code snippet would then use the same range to filter transactions where the Posted Date is in the range the user chose.

Top of page.

Prompt Once For Input

When you are printing a report to a tagged list, Collect! will prompt only once if your report contains a prompt for input. The input will be applied to each account in the list as it is printed.

Collect! can also process multiple prompts within the report and apply them to each tagged account as the report is printed.

tip.gif This relates to selecting the "All" option when printing from a list of tagged accounts.

Top of page.

Mask Data Entry On Prompt

You can also mask data entered when a prompt is presented to the user. One practical use of this is changing a receipt number on a transaction to indicate that the payment about to be processed has been authorized.

The question mark must be followed immediately by an asterisk to alert Collect! for masking the data entry. This works for all the field data types, String, Integer, Date, Time, Currency and Percentages.

Example:
@varNum# = ?* Ask your Supervisor to enter Auth Code


Prompt displays to the end user

When the data is entered in the Prompt, it is masked with "*". This hides the Authentication Code from the operator.


Prompt masks input

In this particular example, the report then changes the receipt number on the payment, using the real value of @varNum.

Example:
@EDITtr.rn = @varNum

The transaction is processed with the proper Authentication Code and account security is preserved.

Top of page.

Summary

Collect!'s report writer enables you to query the user for data while running a report. The information entered by the user is then used by the report to complete the next steps. You can also mask data entered when a prompt is presented to the user.

This topic showed many examples of using prompts in reports. In doing so, it touched on several aspects of report writing that you may not be familiar with.

Please see additional Help topics listed below for further details.

Top of page.

See Also

- How to Filter Data with the Where Clause
- How To Use Variables
- Report Topics Index

Top of page.

Was this page helpful? Do you have any comments on this document? Can we make it better? If so how may we improve this page.

Please click this link to send us your comments: helpinfo@collect.org