Skip to content

GETDBDATA Command

GETDBDATA is a command that can be selected from the Actions drop down list in the test step form. This command is used to fetch the entire row from the database table. It prevents multiple calls to the DB when we want to fetch the data from the same row of the table multiple times.

We can store entire row data in a variable and use it with the help of its column name.

Syntax:

   Action                 Screen                           Element                           Parameters

GETDBDATA          ——–                      variable name                     Scriptname

Example:

   Action                       Screen                        Element                     Parameters

GETDBDATA            ——                                  x                    MySQL_Script_2

x has now stored all the data which is getting fetched by this (MySQL_Script_2) query.

In order to get the data from different columns we will use the syntax as below: Syntax: ${name of variable which has data [column name]}

Example: ${var[last_name]}

 

Tabular view :

Card view :

GETDBDATA syntax in case of multiple Database (when user is fetching data from second DB) will get changed a little bit.

Syntax:

   Action                   Screen          Element              Parameters

GETDBDATA          ——          variable name  DBSetting name : Scriptname

Example:

  Action              Screen            Element                Parameters

GETDBDATA        ——-             x            SQLServer :MySql_Server_Script_1

In order to get the data from different columns we will use the syntax as below. Syntax: ${name of variable which has data [column name]}

 

Tabular view :

Card view :

We can also fetch table data present at different index in the table using below syntax

Syntax: ${var[first_name]@index=2}

Example: ${var[first_name]@index=2}

Tabular view :

Card view :

 

In the above snapshot, index=0 represent the first value in the last_name column, index=1 represent second value in email column and index=2 represents third value in the first_name column. So when you want to fetch first value of the column in the table you need to provide index=0, for second value index=2 and subsequently.

Back To Top