First what is a data-driven task? A remiCrystal data–driven task provides a way to use dynamic task data such as parameter values or email addresses that are retrieved from an external data source at run time. This data source can be your enterprise database, Excel workbook or even a CSV text file.
In order to create a data-driven task, you must specify the data selection criteria using an SQL Query, for example:
SELECT * FROM Customers WHERE Country = 'USA' AND City = 'Miami'
When the remiCrystal task runs, it will connect to the specified data source and use the above query to run the reports and deliver them for each record returned.
The above works marvelously and will always run the reports for the specified criteria. What if, however, you wanted the “Country” and “City” values in the query to be populated from the command line?
First, let’s modify the query above so that it uses parameters instead of static values. We will call our parameters @country and @city and the query will now look like this:
SELECT * FROM Customers WHERE Country = '@country' AND City = '@city'
With this simple change saved, you can now pass in these parameter when executing the remiCrystal task from the command line using the following structure:
[path to remicrystal.exe] /ex "[path to remicrystal rctx task file]" /extdataparams "[pipe delimited key/value pairs of parameters]"
To put the above structure into practice, the command line looks like this:
"c:\program files (x86)\remiware\remicrystal\remicrystal.exe" /ex "c:\users\johndoe\documents\my remicrystal tasks\customer reports.rctx" /extdataparams "@country=usa|@city=new york"
Voila! When the above command is executed, the @country and @city parameters in our external data SQL Query will be replaced with USA and New York respectively.
As you can see, this feature is very useful for advanced users that would like to run one data-driven task and have the SQL Query customized based on command line arguments.
Here are some scenarios when this feature can be used:
- limiting the data that the data-driven task can access based on the logged in ID of a user
- invoking a remiCrystal task from a website and passing the web session ID to remiCrystal
- having scripts (PowerShell, Batch file, SQL) that run a single data-driven task but each script is set to pass different parameter values
- invoking remiCrystal from your application where the parameter values are calculated using custom logic
To get started with this feature and more, download the free unlimited 14 day trial of remiCrystal today!