Property Lists

You can use PilotScript to work with property lists.

This page discusses:

See Also
PilotScript Reference

Property Lists

Each data record that passes through a data pipeline contains a set of named properties known as a "property list". Each property has a name and a value of a particular data type (integer, Boolean, text string, etc.)

Property Name Property Value
Compound
'B29'
VDWVol
336.0999
M_Point
192
Smp_Data
292, 287, 295, 301

Some property values are actually lists of values.

When you write an expression, imagine it being applied against each individual data record as it passes through a data pipeline. When an expression is executed, it has access to these properties of the data record and to the property list as a whole.

Therefore, use the expression language to do the following:

  • Manage list items (for example, add or remove properties or change the property order)
  • Assign a value to a property in the property list
  • Retrieve the value of a property in the property list

Iteration Over Data Record Property List

To provide more flexible access to a data record's property list, you can create a property in PilotScript without identifying a specific property name. You can dynamically build properties by accessing a property by its position in the property list. This makes it possible to iterate over all properties in a data record, using a set of functions designed for an anonymous mode of property access.

The anonymous property list functions include the following:

Function Description Example
IthProperty
Returns a reference to the ith property. Rakes one argument (an integer).
/* Increment ith property by 1 */
IthProperty(#i) := IthProperty(#i)+1
IthPropertyName
Returns the name of the ith property
/* Assign the name of the ith property to a property */
molname := IthPropertyName(#i)
Property
Returns a reference to a property by name. Rakes one string argument.
/* Query the value of a property */
IF ( Property('validate') = 'true') THEN …
NumProperties
Returns how many properties are currently on the property list
/* Query size of the property list */
PropertyListSize := NumProperties()

Increment by 10 all properties whose names begin with "Temp":

FOR #i IN 1 .. NumProperties() 
LOOP 
    IF IthPropertyName(#i) RLIKE '^Temp'  THEN 
        IthProperty(#i) += 10; 
    END IF; 
END LOOP;  
Find missing values in a property and assign a string value:
IF Property('CPS 0.1 sec') IS NOT DEFINED THEN
     Property('CPS 0.1 sec') :='Null';
END IF:
  • For indexes and loop values in scripts, use the local property form, such as #i.
  • A reference to a property means you can assign values to it. Property('zzz') is synonymous with %'zzz'.
  • An index to internal data structures might not be consistent from record to record, and the index for a given property can change. The functions Remove, Keep, RRemove, RKeep, and Reorder alter the number of properties on the property list and their order.
  • A data source can provide data records with missing data properties. For example, the property Assay_Number has index 5 on one data record, but does not mean there will be index 5 available on the next data record, or that it will necessarily be the same property. Attempting to access an invalid property results in undefined behavior.