A CSPro logic object is a variable that is similar to the objects that exist in other programming languages that are
object-oriented. CSPro logic is not fully object-oriented, but some variables have functions—sometimes called methods—that can be called by using both the variable name as well as the function name.
variable_name.function_name();
The following objects have functions that can be called on the object:
A list of available functions can be found in each of those summary pages.
One way to understand dot notation is to think of it as a shorthand way to specify what variable should be used when performing an operation. For example, here are two ways to work through the elements of a list:
Unlike other CSPro functions, the functions that are associated with an object will not show as blue and they are not reserved words.
Using a dot specifies that you are accessing a function or variable (property) of the object. For example, a value set object contains two internal variables, codes and labels, both of which are lists, that can be accessed as in:
List string province_labels = PROVINCE_VS.labels;
numeric selected_province = province_labels.show("Select a province");
This could also be written using multiple dots:
numeric selected_province = PROVINCE_VS.labels.show("Select a province");
When using dot notation on objects, the function generally operates on the properties of the object. Some functions, called
static in many programming languages, do not require an instance of an object to run but still require using dot notation.
Similarly, many programming languages have the concept of
namespaces, often used to group related functionality. In CSPro logic, some functions are defined in namespaces, and the
Action Invoker makes heavy use of namespaces. To execute functions within a namespace, you must use dot notation. For example:
// function in the logic's Barcode namespace
BLOOD_SAMPLE = Barcode.read("Scan the blood sample barcode");
// action in the Action Invoker's File namespace
string manualText = CS.File.readText(path := "manual.txt");