Of course, the contents of a document should differ based on -for example- if the customer is male or female.
...
Dear #
IF Cust.Sex = "M" THEN # Mr. #
ELIF Cust.Sex = "F" THEN # Ms. #
ELSE # Ms. or Mr. #
FI
# @(Cust.Surname),
In reference to your writing...
Although this gets the job done, it is not obvious what text ITP will produce in the result document. Introducing variables will make this somewhat easier.
...
TEXT ms_mr
IF Cust.Sex = "M" THEN
ASSIGN ms_mr := "Mr."
ELIF Cust.Sex = "F" THEN
ASSIGN ms_mr := "Ms."
ELSE
ASSIGN ms_mr := "Ms. or Mr."
FI
#
Dear @(ms_mr) @(Cust.Surname),
In reference to your writing...
In this example, a variable of type TEXT is declared. Then ITP assigns a value to this variable based on the contents of the field. Finally the contents of the variable is merged into the text using the @-construct. Therefore, by separating the logic as much as possible from the text, the structure of the result text can be more WYSIWYG.