Layout Smart Text - MapInfo_Pro - 2023

MapInfo Pro Help

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapInfo Pro
Version
2023
ft:locale
en-US
Product name
MapInfo Pro
ft:title
MapInfo Pro Help
First publish date
1985
ft:lastEdition
2023-09-12
ft:lastPublication
2023-09-12T16:39:16.995000

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

The syntax for a Layout Smart Text expression is:
$mb{mapbasic-expression}
where mapbasic-expression is a valid MapBasic expression.
For example, to display current date in a text frame, use:
$mb{FormatDate$(CurDate())}

Static Text

You can also use Smart Text along with static text, for example:
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.

For example, if you use the expression:
$mb{FormatDate$(CurDat())}

the text frame will show:

Error(615)
When you hover your mouse over the text frame, the tooltip help text will read:
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

If you want the Smart Text expression to be interpreted literally, you can use the escape character backslash ("\") before the Smart Text expression and make it a literal string. For example, if the text is:
\$mb{FormatDate$(CurDate())}

The Smart Text expression will not be evaluated and will be displayed as a literal string:

$mb{FormatDate$(CurDate())}