Home : Prompt
Q11197 - INFO: Prompt

Used to define and place user defined prompts into a report.  When a report is output, WIMS will "prompt" for information that can be placed on a report.  For example, you can setup a prompt that asks “Who is running the report” and then display the name on the report. 

The grid displays prompts that have already been defined for the report.  Click  to define a prompt for the report, then click  to locate the prompt formula into the current cell of the report. 

FIELDS:

Prompt: This is the question the user will be asked when the report is output.

Type: Sets what is to be prompted for.  When the report is output you will be given a … button to browse for the value, the Type field tells the system what type of value to browse for.   IE if the type is set to Location, the … button will display the list of locations to choose from.  The type becomes important when you are using the prompt to pass values to an SQLFIRST/SQLRESULT function.  See examples below. Choose from the following options:

Text
Numeric
VarNum
VarId
Location
Location (Internal Id)
Date
Sample Number
SampleID (Internal Id)
Area
Area (Internal Id)
Event Type
Event Type (Internal Id)
SampleDef Name
SampleDef (Internal Id)
Personnel Code
Personnel Code (Internal Id)
Sample Type (Internal Id)
Test (Internal Id)
SQL

Default Value For:  Sets what value to display as a default when designing the report and sets the default value when the user is entering the prompt value.

Select Comma Separated List:  When the report is output, the 1st  prompt in the report will allow the user to select multiple items.  With this box checked, commas will separate the selected items.  This allows you to select multiple items and pass them to the report for use in a SQLFIRST WHERE IN (…) clause.  If this option is not selected, the selected items will be separated by a tab which will run the report for each item in the list.

Default value for: Sets what value to display as a default when design the report.

 

Click  to add the prompt into the report.

NOTES:

Locates the PROMPT spread function into the report.

USING PROMPTS:

When the report is output the user will be prompted for the value:

 

EXAMPLES:

 Prompts can be used to get text to place on a report or to set criteria for the SQLFIRST/SQLRESULT spread functions.

Example 1: Show all Variables for a Location:

Locate a Location (Internal Id) prompt in cell B3:

Use Locate SQL Results and place the following formula referring to the prompt value in B3:

SQLFIRST(1,1,"","SELECT VarNum,Name FROM VARDESC WHERE LOCID = $P1$",2,50,B3)

 

Example 2: Show a separate report for each selected Lab Cal Sample

Locate a SampleId (Internal Id) prompt in cell B3:

Use Locate SQL Results and place the following formula referring to the prompt value in B3:

 

When this report is run, you will be prompted for SampleIds.  If you select multiple Sample Ids from the list the report will be run once for each Sample Id selected.

 

Example 3: Display Sample Information for the selected Lab Cal Samples

Locate a SampleId (Internal Id) prompt in cell B3 (make sure to check the Select Comma Separated List):

 Use Locate SQL Results and place the following formula referring to the prompt value in B3:

Example 4: Using SQL to Prompt for a Logbook

Set the type to SQL and scroll to the right and enter your SQL statement:  Select ID, LOGBOOKNAME FROM LOGBOOK UNION 0,'Comments'

NOTES on using the SQL type:

  • The first column specified in the SQL Statement will set the answer (in the above example the Answer will be set to the ID field since it is the first column.)
  • Only the first two columns will display when picking a value.
  • Example to prompt only for variables with limits and return the varnum: Select VarNum,Name + ' ' + UNITS FROM VARDESC WHERE VARID IN (SELECT VARID FROM LIMITS) ORDER BY VARNUM

 

 

Advanced Usage:

For information on How to Generate Multiple Reports with a Single Prompt, click here.

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 5/9/2008 2:14 PM.
Last Modified on 1/18/2022 1:59 PM.
Last Modified by Scott Dorner.
Article has been viewed 7769 times.
Rated 8 out of 10 based on 2 votes.
Print Article
Email Article