Obtain Report Data Using a SQL Query
If a list of values returned from the SQL query is used directly inside the SQL statement, the semicolon character needs to be replaced with a comma character. For reports that use a SQL query, MineMarket does this just before the query is executed.
Security Note: You need the Allow report maintenance security right in the Reports domain security rights group for this activity.
Activity Steps
- Open the Report (configuration).
- Select the Data Set Editor tab.
- Set the Data Source Type to SQL Query.
- If a report parameter is to be inserted into the SQL query:
- Configure the report parameter.
- Right-click in SQL Query and select Add Report Parameter from the menu.
- Select the required report parameter from the configured report parameters.
In the SQL Query string, the parameter displays in curly brackets {}. For example:
select * from Product where ProductCode like {ParameterX}
Note: The query string itself does not have to include quotes around the parameter (that is, {Parameter} and not '{Parameter}') because the quotes are automatically added when the actual value is substituted.
- Complete the following fields.
- Database Connection
- SQL Query
Note: The names of the fields in the SQL query string must match the fields in the Crystal Reports template because no data displays if the fields are not properly assigned.
- Click Save.