A prompt is a report property that can be configured when a report is created or modified. When running a report with a configured prompt, you must enter a value for the required parameter before the data can be retrieved for the report. Use the following procedures to configure a report prompt and then to integrate it into the SQL statement for the report.
Procedure
To configure a report prompt
-
In the Configuration Manager console, navigate to System Center Configuration Manager / Site Database / Computer Management / Reporting / Reports.
-
Right-click the report of your choice, and then click Properties.
-
Click Edit SQL Statement, and then click Prompts.
-
Click the New icon to define a new prompt, or right-click a prompt in the Prompts list and then click Properties to edit an existing prompt.
-
Configure the following settings for the prompt:
- Name: Specifies the name for the
prompt. This is a required setting.
- Prompt text: Specifies the prompt text
that is displayed when the report runs. This is a required
setting.
- Default value: Specifies the default
value that is automatically inserted into the prompt text box when
a report runs. This is an optional setting.
- Allow an empty value: Specifies
whether the prompt value is required or if it is optional. By
default, this setting is not enabled and the prompt value is
required.
- Provide a SQL statement: Specifies
whether a list of possible values will be retrieved for the prompt
based on a SQL statement. When it is enabled, click Edit SQL
Statement to specify the SQL statement for the prompt. For more
information about specifying the SQL statement for a prompt, see
Prompt SQL
Statement Dialog Box.
- Name: Specifies the name for the
prompt. This is a required setting.
-
Click OK, click OK, and then click OK again to save the prompt.
To integrate the report prompt into the SQL statement
-
In the Configuration Manager console, navigate to System Center Configuration Manager / Site Database / Computer Management / Reporting / Reports.
-
Right-click the report of your choice, and then click Properties.
-
Click Edit SQL Statement to open the Report SQL Statement dialog box.
To integrate a prompt into the report, you must specify the prompt name as a variable in the SQL statement of the report by using the syntax @promptname. The following SQL statement example integrates a prompt named username into the SQL statement for the report. When the report runs, it requests the user name, and then it will return data from the v_R_System view where the User_Name0 field is equal to the value entered for the prompt.
SELECT SyS User_Name0 AS 'User Name', SYS.Name0 AS 'Computer Name' FROM v_R_SYSTEM SYS
WHERE User_Name0 LIKE @prompt2
-
Click OK, and then click OK again to save the changes to the report.