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

  1. Open the Report (configuration).
  2. Select the Data Set Editor tab.
  3. Set the Data Source Type to SQL Query.
  4. If a report parameter is to be inserted into the SQL query:
    1. Configure the report parameter.
    2. Right-click in SQL Query and select Add Report Parameter from the menu.
    3. 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.

  5. 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.

  6. Click Save.