Changing Property Values

You can use PilotScript to change the property values in a data record.

This page discusses:

See Also
PilotScript Reference

Setting Property Values

To set the value of a property, use colon-equals (:=) and assign a string (T56) to a property (Compound):

Compound := 'T56’;

Assign a number (145) to a property (M_Point):

M_Point := 145;

Retrieve a value from one property (M_Point) and assign it to another (S_Point):

S_Point := M_Point;
  • To test if two values are equal, use a double equal sign (==) on its own, as a conditional operator.

    Examples:

    • a := 5 assigns the value (5) to the property (a)
    • a == 5 tests the value of property (a) and evaluates to True or False.
  • If you try to retrieve the value of a property that does not exist, an error is returned.
  • You can always set the value of a property. If it does not exist, it is created.
  • If you write an expression with multiple statements, terminate each statement with a semicolon (;).
  • A single statement can extend to multiple lines. Be sure to use a semicolon (;) at the end of the statement to terminate it.

Setting Array Property Values

To set the value of a property to an array, use colon-equals (:=) and the Array function. For example, we can initialize a property to an array of filenames:

Filenames := Array(‘Assay1.txt’,’Assay2.txt’,’Assay3.txt’);

You can also create an array of floating point numbers:

Floats := Array(3.14159, 2.718, 0.57721);

Creating an array of integers is trickier, as numbers (even written without the decimal point) are interpreted by default as doubles in PilotScript. However, you can wrap them with the Integer function. Here is an array of integers:

Primes := Array(Integer(2), Integer(3), Integer(5), Integer(7), Integer(11));

Removing Property Values

To remove a property, use the Remove() function:

Remove ('Compound');

This works for properties that you recently created or with existing properties on the data record passed to the expression.