Help Center - DataDriven

DataDriven

DataDriven lets Smart Report Organizer generate and distribute individual Crystal Reports for every record returned by a database query. Instead of creating a separate job for each customer, invoice or department, configure one report job and let DataDriven process the records automatically.

For example, a query returning 500 invoices can trigger 500 individual report executions, each with its own report parameters, PDF filename and email recipient.


How DataDriven Works

  1. The existing Smart Report Organizer schedule starts the job.
  2. DataDriven executes the configured database query.
  3. The query returns a set of records (rows).
  4. For each row, Smart Report Organizer resolves the configured expressions and runs the Crystal Report using the existing report job settings.
  5. The resulting report is exported and optionally delivered by email.

Example: 100 query rows = up to 100 individual report executions. DataDriven does not change when a job is scheduled; it changes how many times the job runs after the schedule is triggered.


1. Create a DataDriven DataSource

A DataDriven DataSource contains a name, a database connection and an SQL query. The query determines which records will be processed.

  1. Open DataDriven > DataSources in the left navigation.
  2. Create a new DataSource and enter a descriptive name.
  3. Configure the database connection.
  4. Use the SQL Query Builder to define the records and fields to retrieve.
  5. Execute or preview the query to check the returned data, then save the DataSource.

Choose the SQL query that fits your needs. The basic example retrieves only three essential fields: the invoice ID required by the Crystal Report parameter, the invoice number for generating unique export filenames, and the customer's email address for delivery. The personalized example includes additional invoice and customer details for dynamic email subjects, personalized greetings, and invoice information . Both queries select only yesterday's open invoices from the included Demo Database, rather than processing every invoice in the database.

Basic Example
SELECT
    I.InvoiceID,
    I.InvoiceNo,
    C.Email
FROM Demo.Invoice I
INNER JOIN Demo.Customer C
    ON C.CustomerID = I.CustomerID
WHERE
    CONVERT(date, I.InvoiceDate)
        = CONVERT(date, DATEADD(DAY, -1, GETDATE()))
    AND I.Status = 'Open'
Personalized Email Example
SELECT
    I.InvoiceID,
    I.InvoiceDate,
    I.InvoiceNo,
    I.Status,
    C.Email,
    C.CompanyName,
    C.FirstName,
    C.LastName,
    I.SubTotal,
    I.TaxAmount,
    I.TotalAmount
FROM Demo.Invoice I
INNER JOIN Demo.Customer C
    ON C.CustomerID = I.CustomerID
WHERE
    CONVERT(date, I.InvoiceDate)
        = CONVERT(date, DATEADD(DAY, -1, GETDATE()))
    AND I.Status = 'Open'
Important – Filter Your Data: DataDriven processes each record returned by your SQL query. Always use appropriate WHERE conditions to select only the records you actually want to process. Without proper filtering, you may unintentionally generate and distribute reports for your entire database.

Each returned row provides values that can be used by the report job. Your database column names do not need special SRO-specific prefixes.


2. Enable DataDriven in a Report Job

Create or open a regular Crystal Report job. With an appropriate Enterprise license, the Show DataDriven button is available in the ribbon.

  1. Click Show DataDriven to display the DataDriven panel on the right.
  2. Choose an existing DataSource from the DataSource dropdown.
  3. Click Run Query to retrieve the records and discover the available database fields.
  4. Select a record in the results grid to preview how its values will be used by the job.
Important: SRO can only offer the DataSource's fields after you click Run Query. The ribbon's Insert Field command and the corresponding right-click field selection become available after the query has been executed.

You can then insert database fields into supported job settings without manually typing their names. Continue using the usual configuration for parameters, destinations, email delivery and scheduling.


Try DataDriven with the Included Demo Database

You can explore DataDriven without preparing your own customer database. Smart Report Organizer includes a Demo Database with sample customers, employees, articles and invoices.

  1. Open Demo > Demo Database to explore the sample data.
  2. Use the available demo-data commands to create sample data or invoices, if needed.
  3. Create a DataDriven DataSource based on the demo data and run its query.
  4. Configure a report job with expressions and preview several invoice records.

Safe sample addresses: The included sample email addresses use the example.com domain rather than real customer addresses, helping prevent accidental delivery to actual customers. To test actual email delivery to yourself, use Email Test Mode as described below.


3. Use Dynamic Expressions

DataDriven expressions insert values from the current query row into your job settings. Write a field name between double curly brackets: {{FieldName}}.

ExpressionExample resolved value
{{ID}}3372
{{Email}}customer@example.com
Invoice {{InvoiceNumber}}Invoice 1100206
{{CustomerName}} - {{InvoiceNumber}}Example Company - 1100206

You can combine ordinary text with one or more expressions. Field names must match columns returned by the DataDriven query. After Run Query, use Insert Field in the ribbon or the corresponding right-click menu to insert available fields. The menu also offers formatting choices for supported fields, such as numbers.


4. Dynamic Crystal Report Parameters

Map report parameters to values from the current query row. For example, if the Crystal Report has a parameter named ID, enter {{ID}} as its value/expression. Each execution then receives the ID of its current row.

This allows a single Crystal Report to generate a different invoice or customer report for each record.


5. Dynamic Export Filenames and Folders

Use expressions in export filenames and directories to organize the generated files.

SettingExample expressionExample result
FilenameInvoice_{{InvoiceNumber}}Invoice_1100206.pdf (when exporting as PDF)
FolderC:\Invoices\{{CustomerName}}C:\Invoices\Example Company
Important – Unique Filenames: Make sure each DataDriven record generates a unique export filename. Use expressions such as Invoice_{{InvoiceNo}} to prevent files from being overwritten or mixed up between customers. This is especially important when generating and emailing multiple reports.

Tip: Ensure query values used in paths contain only valid filename and directory characters.


6. Personalized Email Delivery

DataDriven can personalize the email sender, recipients, subject and message for every record. Configure an Email Profile and enable email delivery in the report destination settings.

FieldExpressionExample preview
To{{Email}}customer@example.com
SubjectInvoice {{InvoiceNumber}}Invoice 1100206
BodyDear {{CustomerName}}, your invoice is attached.Dear Example Company, your invoice is attached.

Expressions can also be used in supported From, CC and BCC fields. For HTML emails, the preview renders the resolved HTML rather than displaying only its source code.

<strong>Invoice {{InvoiceNumber}}</strong>
<p>Dear {{CustomerName}}, please find your invoice attached.</p>

7. Test Email Delivery Safely with Email Test Mode

Before sending personalized emails to many recipients, enable Email Test Mode in the DataDriven panel.

  1. Turn on Email Test Mode.
  2. Enter your own address in Test Email Address.
  3. Set Maximum Records, for example 10, to limit the number of DataDriven records processed during the test.
  4. Run the job and check the emails and generated attachments.
Recipient protection: While Email Test Mode is active, emails are sent only to the Test Email Address, regardless of the configured To, CC or BCC values. Other configured exports remain active. Review the export destinations before testing.

Once the results are correct, disable Email Test Mode before using the job for its intended recipients.


8. Preview Your Expressions

DataDriven shows the stored value or expression alongside its resolved preview for the selected query record.

  • Left: The value or expression you edit and save.
  • Right: A read-only preview showing the resolved value.
  • Select another row in the query results to see how values change.
  • Modify an expression to update its preview immediately.

Only the expression/value is saved with the job; preview values are not stored as job settings.


9. Schedule and Run DataDriven Jobs

Configure the schedule exactly as you would for a normal report job. When the schedule triggers, SRO first executes the DataDriven query and then processes the returned records.

For an initial test, use a query that returns only a few records. Verify the generated report content, filenames and email recipients before processing a large result set.


10. Monitor Results and Troubleshoot Errors

Use Smart Report Organizer's job status and logs to review DataDriven processing. The detailed log information helps identify which record and report parameters were involved in an execution or error.

If a result is unexpected, check the query output, the selected field names, the resolved expressions, the report parameters and the configured export/email destination.


Where Can DataDriven Expressions Be Used?

Once the query has been run, database fields can be inserted into many supported settings of the regular report job:

  • Crystal Report parameters: Pass the current record's values to the report.
  • Email: From, To, CC, BCC, subject and HTML body.
  • Export destinations: Export folder and filename.
  • Additional destination settings: Depending on the field, dynamic values can also be used for printer names, PDF protection passwords, ZIP archive filename/password and FTP settings.

Look for the expression controls and the fx or field insertion options in the relevant settings.


Best Practices

  • Start with the included Demo Database or a small, known set of query rows.
  • Use Email Test Mode with your own address and a small Maximum Records value for initial delivery tests.
  • Return only the columns needed by the job and use clear column names.
  • Use a unique identifier such as an invoice number in the exported filename.
  • Check the recipient address and resolved subject before enabling bulk email delivery.
  • Make sure the database query returns exactly the records you intend to process.
  • Review the logs after the first full execution.

Important Information Before Production Use

Smart Report Organizer DataDriven is a powerful automation feature that requires basic technical knowledge, an understanding of SQL queries, and careful configuration.

Before using DataDriven in a production environment, thoroughly test your queries, report parameters, export destinations and email settings.

You are responsible for verifying that reports contain the correct data and are delivered to the intended recipients.

We strongly recommend using the included Demo Database and Email Test Mode before processing real customer data.

You're ready! With one DataDriven DataSource and one report job, Smart Report Organizer can generate and distribute individually personalized Crystal Reports automatically.