All data types have attributes. Attributes are always readable, but not all attributes can be changed.

Examples of attributes include tables with the number of columns or the maximum size of the text.

Use the : operator to indicate attribute.

variable:Attribute

Read Access to Attributes

To read the value of an attribute, make a simple assignment to another variable with a suitable data type.

value = variable:Attribute

Example

program
   section globals
     text textVariable
   endsection
   file fileVariable
   serial serialVariable


   int32 len = textVariable:length
   text pathName = fileVariable:pathName
   serial:baudRate baud = serialVariable:baudRate

endprogram

Write Access to Attributes

Use a simple assignment to change the values of attributes.

You can choose the following variants for this assignment if the data type of the assigned expression matches the data type of the attribute:

  • Value of another variable
  • Constants or lists
  • The result of a calculation for numeric data types
  • Return value of a function
variable:Attribute = variableX
variable:Attribute = constantX
variable:Attribute = enum:value
variable:Attribute= variableX operator constantX
variable:Attribute = functionCall ()

Example

program
   int32 timeout = 1
   serial serialVariable
   serialVariable:receivedBytesThreshold = 60
   serialVariable:baudRate = serial:baudRate:38400
   serialVariable:timeout = intTimeOut * 60
endprogram