222 Chapter 5
Storing and Retrieving Test Results
Using Records to Store Mixed Data Types
Using Records to Store Mixed Data Types
The Record data type can store different data types in a single data container.
Record can include any VEE data type. The data can be in the shape of a
Scalar or an Array. You can store a test name, a time stamp, and a real array
in a single data structure.
The individual elements in a Record are stored as fields and are accessed
using a dot notation. For example,
Rec.Name accesses the field called Name
within a Record called
Rec. In an array of records, Rec[2].Name signifies
the
Name field in the third record in the array. All arrays start indexing at
zero.
There are several benefits to structuring test data using the Record data type:
n You can create logical groupings of mixed data types in a single
container, which makes a program easier to develop and maintain. For
example, you might use the following fields for a record storing test data:
test name, value returned, pass or fail indicator, time stamp, nominal
value expected, upper pass limit, lower pass limit, and a description of
the test.
n You can manipulate a single data container rather than eight separate data
containers. This makes the program simpler and more readable.
n You can store and retrieve Records from DataSets in VEE. A DataSet is
a special file created to store records. When you retrieve records from a
DataSet, you do not have to know the data types. VEE provides objects to
retrieve, sort, and search the information stored in DataSets.
Lab 5-4: Using Records
This exercise describes how to use the Record datatype. You will learn how
to build a record, how to retrieve a particular field in that record, how to set a
chosen field, and how to unbuild the entire record in a single step. This
exercise also uses the time stamp function
now() in a different way.