KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Not so common use of the String command
PRODUCT: 4D | VERSION: 16/15/14/13/12/11 | PLATFORM: Mac & Win
Published On: October 14, 2016

A not so common use of the string command is to translate a Boolean value into text. The snippet below shows how too use the String command in this role.

Instead of:

If([INVOICE]Paid = True)
  $Answer_T:="Yes"
Else
  $Answer_T:="No"
End if

Do this:

$Answer_T:=String([INVOICE]Paid;"Yes;;No")

Note, there is are two semicolons separating the responses. This is a format string, not response values.

Alternatively you could use the Choose command:

$Answer_T:=Choose([INVOICE]Paid;"Yes";"No")

In this case note there are two response values.