Devart Blog

How to specify parameters in a report through the command line

Posted by on April 23rd, 2015

dbForge Studio for SQL Server gives you an opportunity of automating the variety database management processes. One of them is specifying parameters in a report making use the command line.

The /parameters switch is used to specify values for parameters declared in a query script. To perform this task, you need only type the name of a parameter you want to assign a value to and its correspondent value, like this:

<param_name1>:<param_value1>
<param_name2>:<param_value2>

<param_namen>:<param_valuen>

The required string in the command line will be as follows:

C:\Program Files\Devart\dbForge Studio for SQL Server>dbforgesql.com /datareport /parameters param1:value1 param2:value2

While as in the usual way you should:

  1. Write a query script.
  2. Execute the query.
  3. Specify required parameters in the Edit Parameters dialog box that appears when executing a query. (Alternatively, you can specify parameters in an already created Data Report).
  4. Make a report with the help of the Data Report Wizard.

EXAMPLE

Let’s observe this process in a real example where we ought to filter employees by their ID numbers in the employees’ database and find the exact one, with ID number 963.

  • Here is the script of the executed query with the created @id parameter that is equal to 963.

Query Execution

  • To specify parameters through the command line, just run the command line and type the following string of arguments:

“C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com” /datareport /reportfile:”Report1.rdb” /parameters id:963 /format:HTML /result folder:”D:\report\”

If the process is successfully completed, an output folder of a result file is displayed.

The report files with parameters specified via the command line and with the help of the Data Report Wizard look identical:

result-file-report

Thus, specifying parameters through the command line saves your time, you get the same results quickly and automatically, without typing any code.

To learn more about additional command-line arguments supported in dbForge Studio for SQL Server, refer to the documentation of dbForge Studio for SQL Server.

To learn how to specify parameters via the Data Report Wizard, read the Report Parameters article.

See also
Leave a Reply