Layout Smart Text is an enhancement to text frames in the Layout Designer. Previously you could only add static text to text frames in the Layout Designer. Smart Text provides the ability to embed dynamic values that can change based on the context. For example, you may wish to include the current date or the layout page number as text in a Layout. Smart Text uses MapBasic expressions to accomplish this.
Syntax
$mb{mapbasic-expression}
where
mapbasic-expression is a valid MapBasic expression.$mb{FormatDate$(CurDate())}
Static Text
Current date: $mb{FormatDate$(CurDate())}.
In normal mode, the result of this expression would be displayed as:
Current Date: 10/25/2017
Handling Errors
If the Smart Text contains an invalid MapBasic expression, the text will appear in red with the MapBasic error number. Additionally, if you hover over the text frame the tooltip will show the complete MapBasic error.
$mb{FormatDate$(CurDat())}
the text frame will show:
Error(615)
Error evaluating FormatDate$(CurDat())Error(615): Found [(] while searching for [)]. Invalid or missing argument list.
You must edit the smart text expression and fix all syntax errors.
Escaping a Smart Text Expression
\$mb{FormatDate$(CurDate())}
The Smart Text expression will not be evaluated and will be displayed as a literal string:
$mb{FormatDate$(CurDate())}