Pinnacle : Float Variables

Description

The float variable is the only type of numeric variable available in Pinnacle scriptng. It can hold most numbers but is limited to [Unknown]. Floats are used in place of other common numerical variables like int and long.

Declare a float variable

Store.FloatAt.SampleFloat = 5.141;

or

Store.At.SampleFloat = Float {Value = 5.141;};

The name “SampleFloat” should be replaced with a more descriptive name. If the variable does not exist it is created, otherwise the current variable is overwritten.

Mathematical Operations

Display value in pop-up window

InfoMessage=Store.FloatAt.SampleFloat;//Outputs 5.141

Add

Store.At.SampleFloat.Add = 1;  // 5.141 + 1 = 6.141

Subtract

Store.At.SampleFloat.Subtract = 3;   // 6.141 - 3 = 3.141

Multiply

Store.At.SampleFloat.Multiply = 5;   // 3.141 * 5 = 15.705

Divide

Store.At.SampleFloat.Divide = 6;   // 15.705 / 6 = 2.6175

Square

Store.At.SampleFloat.Square = "";   // 2.6175^2 = 6.85130625

Square root

Store.At.SampleFloat.SquareRoot= "";   // 6.85130625^(-1/2) = 2.6175

Invert

Store.At.SampleFloat.Invert= "";   // 1 / 2.6175 = 0.38204394

Negative

Store.At.SampleFloat.Negate= "";   // -0.38204394

Absolute value

Store.At.SampleFloat.Absolute= "";  // 0.38204394

Round to nearest integer

Store.At.SampleFloat.Nint = "";   //

Round down (Floor)

Store.At.SampleFloat.Round = "";   //

Typecast to String Variable

Unlike typecasting (converting) from string to float variables, it’s necessary to use the “StringAt” (string) and “At” (float) definitions of the variables.

Store.Float.At.Number = 7;

//--------**This step typecasts**
Store.StringAt.Text = Store.At.Number;
//

InfoMessage = Store.StringAt.Text;

Free a float variable

To delete a float variable use the FreeAt command. This will remove the variable from the store.

Store.FreeAt.TempFloat = "";

Examples

Find and display the total prescribed dose.

Store.FloatAt.TotalDose=TrialList .Current .PrescriptionList .Current .PrescriptionDose;
Store.At.TotalDose.Multiply = TrialList .Current .PrescriptionList .Current .NumberOfFractions;
Store.StringAt.TotalDoseLabel=Store.FloatAt.TotalDose;

Store.At.TotalDoseLabel.AppendString = "cGy =";

InfoMessage = Store.StringAt.TotalDoseLabel;