Variables are the basic properties, or data points, associated with the product. The main purpose for creating variables is to capture the information necessary for pricing products. However, variables are just as valuable for capturing the information used in production.

In CFL, variables may be either local or global. Local variables are used for temporary calculations during order entry. They are convenient when simplifying complex calculations, but they cannot directly hold user-entered information. Global variables are used for storing information, calculations, and other data that are used throughout the program. Anything a user enters or gets back will use global variables.

CFL provides a number of variables types for use. Each data type is designed to allow the user to specify the defaults and related information to make using the variable much easier. The variable data types supported in CFL are:

  • Boolean/Yes-No
  • Date Time
  • Image
  • Numeric
  • Object
  • Selection List
  • Table Lookup
  • Text

Boolean/Yes-No Variables

Boolean/Yes-No Variables are variables whose value can be either yes(true) or no(false).

Internally, Control will treat 0 as false and anything this is not zero as true.

DateTime Variables

DateTime Variables are variables whose value stores a date and/or time. Dates and times can be added and subracted.

Internally, Control stores the date in the integer part of a number and the time is the function of the day. (Ex. Noon is 0.5 where as 6 p.m. is 0.75.) The date is stored as the number of days since 12/30/1899.

Image Variables

Image Variables store many things. They store:

  • the path to the original image file
  • a thumbnail of the file image
  • the date and time the file was last edited

Number Variables

Number Variables store real numbers with up to 12 digit precision.

Object Variables

Object Variables are complex variables that store the parent object of a UDF. The parent object may be a Company, a Contact, an Employee, or a Transaction.

Selection List Variables

Selection List Variables store two things. The variables store a string corresponding to the selection made. They also store the name of the list being used.

Table Lookup Variables

Table Lookup Variables hold a reference to 1, 2, or 3 dimensional look up tables and stores the value that is looked up.

Text Variables

Text Variables hold strings of values. The strings may be up to 65,000 characters long.

Variable Properties

Control 4.2 introduced a new feature called Variable Properties. Similar to how like selection list properties allow multiple values to be associated with one selection list choice, variable properties allow you to retrieve and store multiple values for a single variable.

An unlimited number of variable properties are allowed for each variable, and are frequently used for values that may be calculated but not often referenced or for which the creation of a separate variable is not desired.

Inside of any CFL formula, you can use the following functions:

SetVariableProperty( variable, “property”, Value );

GetVariablePropertyValue( variable, “property”, DefaultValue )

GetVariablePropertyText( variable, “property”, DefaultValue )

Where,

Variable.Property is the name of the variable and property, separated by a period.

Value is the value you are setting the property to.

DefaultValue is the value to use if no such property is defined on the referenced variable.

Function Parameters Returns…
SetVariableProperty Variable,
PropertyName
Value
No value. This function sets the variable property S to Value but does not return anything.
S should be of the form “VariableName.PropertyName”, such as “Calculations.TotalArea” or “Colors.RGBValue”
GetVariablePropertyValue Variable,
PropertyName,
DefaultValue
The numeric or boolean variable property named in S if it exists, otherwise the DefaultValue is returned.
GetVariablePropertyText Variable,
PropertyName,
DefaultValue
The text variable property named in S if it exists, otherwise the DefaultValue is returned.


You could leave a comment if you were logged in.