User`s guide

244 VEE User’s Guide
5 Storing and Retrieving Test Results Chapter
Performing a Sort Operation on a Record Field
This exercise uses the dataset2.vee program from a previous
exercise. The dataset2.vee program sets a condition in the
From DataSet object such as Rec.B>=0.5, and VEE extracts
all the records that meet the requirement. The array of
resulting records is displayed in the Record Constant object.
In this exercise, dataset2.vee is modified to sort the resulting
records to determine which tests are failing by the greatest
margin. The tests are sorted by the second field in
descending order.
1 Open the dataset2.vee program.
2 Select Device Formula and connect the From Data Set
data output pin Rec to the Formula object data input pin.
Double- click the Formula expression field to highlight the
default formula, then enter sort(a, 1, B”).
The Sort object is located in the Function & Object
Browser, Array Category functions. You can read detailed
information on its capabilities in the object menu Help
entry. The sort() function is called from the Formula
object.
The first parameter sorts the data on the Formula object
A pin, which is in an array of records. The second
parameter indicates the direction of the sort: any
non- zero number indicates an ascending direction, a zero
indicates descending. The default direction is ascending.
The third parameter, in the case of a Record data type,
indicates the name of the field to sort. Therefore, this
performs an ascending sort on the B field in the array of
records.
3 Select Display AlphaNumeric and connect it to the data
output pin of the Formula object.
4 Run the program a few times. It should look similar to
Figure 145. Notice that the program sorts all of the
records returned from the DataSet file in ascending order
by field B.