background image
<< Standard and User-Defined Data Types | Creating User-Defined Data Types >>
<< Standard and User-Defined Data Types | Creating User-Defined Data Types >>

Finding Out What Data Types You Need

Working with Datapools
10-10
User-defined data types are useful in situations such as:
­
When a field accepts a limited number of valid values. For example, suppose
a datapool column supplies data to a script variable named
color
. This
variable provides the server with the color of a product being ordered. If the
product only comes in the colors red, green, blue, yellow, and brown, these
are the only values that
color
can be assigned. No standard data type
contains these exact values.
To ensure that the variable is assigned a valid value from the datapool:
1. Before you create the datapool, create a data type named Colors that
contains the five supported values (
Red
,
Green
,
Blue
,
Yellow
,
Brown
).
2. When you create the datapool, assign the Colors data type to the
datapool column COLOR. The COLOR column supplies values to
the script's
color
variable.
­
When you need to generate data that contains multi-byte characters, such as
are used in some foreign-language character sets. For more information, see
the section Generating Multi-Byte Characters on page 10-13.
Before you create a datapool, find out which standard data types you can use as
sources of data and which user-defined data types you need to create. Although it is
possible to create a data type while you are creating the datapool itself, the process of
creating a datapool is smoother if you create the user-defined data types first.
Finding Out What Data Types You Need
To decide whether to assign a standard data type or a user-defined data type to each
datapool column, know the kinds of values that are supplied to script variables during
playback -- for example, will a variable contain names, dates, order numbers, and so
on.
Here are two ways you can find the kind of values that are supplied to a variable:
¾
With session scripts, you can view the
DATAPOOL_CONFIG
section that Robot
automatically adds to the end of the script. (Robot adds this information to a
session script when you select Use datapools in the Generator tab of the
Session Record Options dialog box.)
The
DATAPOOL_CONFIG
section contains a line for each value assigned to a
script variable during recording. In the following example, the value
329781
is
assigned to the variable
CUSTID
:
INCLUDE, "CUSTID", "string", "329781"
For more information about the
DATAPOOL_CONFIG
section of a script, see
Step 1. Editing Datapool Configuration on page 10-14.