TEXT TO <VariableName> [ADDITIVE]
TextLines
ENDTEXT
TextLines | Specifies text to assign to the variable VarName |
TO <VariableName> | Specifies the variable name to use for passing the contents of the TEXT...ENDTEXT. This variable should be of type string, or should allow that a string can be added to it. It does not have to be a local variable, it can also be a field in the current class or an expression (someVar:SomeField) |
ADDITIVE | Determines whether the contents of the TO variable are overwritten or added to existing contents. |
FUNCTION Start() AS VOID
LOCAL cValue AS STRING
TEXT TO cValue
Line 1
Line 2
Line 3
ENDTEXT
? cValue
TEXT TO cValue ADDITIVE
Line 4
Line 5
ENDTEXT
? cValue
RETURN
The first time the variable will contain 3 lines of text delimited with CR/LF. The second time there will be 5 lines.
The code produced by the compiler will somewhat look like this:
FUNCTION Start() AS VOID
LOCAL cValue AS STRING
cValue := ""
cValue += "Line 1" + chr(13)+chr(10)
cValue += "Line 2" + chr(13)+chr(10)
cValue += "Line 3" + chr(13)+chr(10)
? cValue
cValue += "Line 4" + chr(13)+chr(10)
cValue += "Line 5" + chr(13)+chr(10)
? cValue
RETURN