Documentation

SQL function

This function s used to execute a sql query on the connected database and fetch the output.

Select SET command from the action dropdown and provide a variable name in Element key where output will be stored, edit parameter section and click on Form, select functions from the dropdown and select SQL function. Provide DB setting name and SQL file name separated by colon(:), and varData if there is any data to be given in the script.

Here, DB setting name is defined under settings and this is the place where required data is given for the connection with database. Go to Settings > Project Settings > DB Settings and provide the required details.

In the above snapshot, highlighted names are the DB setting names.

SQL queries are written under Data > Manage SQL Scripts as shown below:

varData is given when you want to parametrize your sql query by giving some input from here. For Example if you have a sql query written as given below:

Now instead of hardcoding emp_no=’4′ , you can parameterize and pass the value of emp_no from the varData field. In that case you will have to use a variable along with @ sign in your sql query as shown below:

Now, in you will pass the value of num variable from the varData field as shown below:

Syntax for above varData= variable name : value

Data fetched from the sql query will be stored in a variable defined in Element Key and after completing this step, test will look as below:

Was this page helpful?