Dataset using query parameter is used where the user wants to fetch response from a database using query and use the value using this parameter.

### Adding The Parameter

The following fields need to be filled to add Dataset Using Query Parameter :

- Query : Query is a question which is communicated formally. It can either be a select query or an action query, for e.g. select name, price, size, id from items_table where skuid=S80 and price >= 1000.
- Parameter Name : This field is used to set the name of the Parameter, which is used in the parameterization of the script with curly braces {}. It is a mandatory field.
- For example :sid,browserplugins,bpcompleted,bpabandoned,channel,trnum.

- Host : It is the host name for the database.
- Port : It is the listening port/default port for SQL Server.
- Username : The username of the database.
- Password : The password for a particular user.
- Database : The name of the databases of DSN such as Postgres, MySQL, Oracle, and SQL Server.
- Driver : A database driver is a computer program that implements a protocol (ODBC or JDBC) for a database connection.

Once all the above fields are filled, click the Test DB Connection button to test the connectivity with database.

### Advanced

Click the icon to see the fields in the advanced option.

Save To File :There can be situations when the user might want to save this data in the file. For such situations, this checkbox comes into the picture.

Once you check this box following fields appear :

- Data File : Enter the data file location in this field.
- First Data Row : In some situations, the user might want the Load Test to start reading data from a particular line number. So, the user can use this field to indicate Load Test which lines it should consider as the first Data row.
- Column Delimiter : This field specifies which character in the data file should be considered as a column separator. By default, the column delimiter is ‘,’. Users can also use special symbols as the column delimiter.

#### Selection Mode

Any data file can contain various numbers of rows. How Load Test know which row to pick from these rows? For this, users can have various methods for Row Selection :

- Sequential : This method selects rows sequentially i.e. the first row, then the second row, then the third row, and so on. It is selected by default.
- Random : This method selects rows randomly. When enabled, Load Test can pick any row from the data file.
- Weighted Random : This method randomly selects a row based on a weight value. When used, the first column of the data file is treated as weight.
- Unique : This method selects a row from the data file uniquely i.e. for all the sessions running currently, one data value is used only once.
- Use Once : This method uses one data value only once. Once a data value is used, it is deleted from the data file. Each deleted value is written in a separate data file with extension .used.
- RemoveDupRecords (if selection mode is UNIQUE) : Select 'Yes' if you want to remove the duplicate records otherwise select 'No'.
- UseOnceWithinTest (if selection mode is USE ONCE) : Select 'Yes' if you want to use data value once within the test otherwise select 'No'.
- Save Last Used Data After (if selection mode is USE ONCE) : In this you can save last used data either after every value or a particular value.
- After All Parameters are used(if selection mode is USE ONCE) : Select any of the following option once all the parameters are used:
  - Abort Session
  - Abort Page
  - Abort Test
  - Abort User

#### Updated Value on

This field is used to specify when to pick a new data value, i.e., generate once and use this value for the entire session, or pick a new data value every time File Parameter is used. Users can have two options :

- Session : If Session is selected, data is picked only for the first use of File Parameter. In this instance, the same value is applied throughout the entire script.
- Use : If Use is selected, data is picked from the data file for each use of File Parameter i.e. if File Parameter is used, for example, 50 times in the script, then for every reference, the new data value is picked.

#### Encoding Options

This option is used to encode special characters to their ASCII value. This option contains 3 fields :

Encode : In Load Test, the user can encode any number of special characters i.e. all, specific, or none. Users can have the following options :

- Encode all special characters except (+), (-), (.), (_) : All special symbols except + - . _ are encoded. It is the default value.
- Encode only specified characters : The user can specify which special characters to encode in the Characters to encode
- Do not encode special characters : None of the special characters is encoded. However, space is encoded always.

Characters to encode : If the user selects Encode only specified characters option in Encode, then this field becomes active. Here user can specify which special characters should be encoded.

Encode Space By : This option specifies to Load Test how to encode Space. Users can have two options : ‘+’ and ‘%20’. If ‘+’ is chosen, Load Test encodes Space by ‘+’ and if ‘%20’ is chosen, Load Test encodes Space by ‘%20 The default value is ‘+’.

Copy File to Test Run : Check this box if you want to copy the file in the Test Run.

Notes :

1. If your values contain special characters that you prefer not to encode, you have the choice of using either "Do not encode special characters" or "Encode only specified characters." A practical illustration of this situation can be found in the domain name https://www.cavisson.com, which includes special characters such as (:/).