Tech Tip: String, Num, & Time can handle undefined expressions starting in v16R5
PRODUCT: 4D | VERSION: 16R5 | PLATFORM: Mac & Win
Published On: January 25, 2018
Prior to v16R5, the String, Num, and Time commands were not able to take undefined expressions as a parameter. The following code is described when compiled and in interpreted mode:
C_TEXT($resultStr) C_REAL($resultNum) C_TIME($resultTime) $resultStr:=String($undefinedString) $resultNum:=Num($undefinedNum) $resultTime:=Time($undefinedTime) |
Compiled:
When the code is compiled, it will generate an error:

Any errors in general after being compiled cannot create a ".4DC" and/or built application. Deployment in this case is not possible.
Interpreted:
When the code is developed or ran in interpreted mode in v16R4, it produces syntax errors as shown below:
1. Using the String command

2. Using the Num command

3. Using the Time command

But in v16R5, it has the ability to accept those undefined expressions as shown below and it does not generate a syntax run time error in this interpreted mode:

This is useful when the command expects a result of a type but also undefined values that defaults to a value which avoids the syntax errors.
Note: Although v16R5 can give you a pass of not having the run time error for these types, it is highly recommended to check syntax your code as shown below:

See Also: