MapInfo Products KnowledgeBase

Product: MapInfo
Version: 4.x\5.x\6.x
Platform: Not Platform Related
Category: Labels & Autolabeling

Summary:
Using expressions for labeling.

Question:
How to create a label expression.

Answer:

Often it is desirable to create a label for an object with information that is contained in multiple columns. The best way to achieve this functionality is to create an expression that defines the label.

To create an expression, choose Map>Layer Control and click on the Label button to bring up the Label Options dialog. In this dialog, select Expression from the "Label With" pull down. At this point, enter in an expression.

The following examples are based on the CUST browser that is pictured below. Substitute the names of the columns in the table being used in place of the column names in the examples.


1. A string constant can be added to a column's contents to clarify the meaning of a label. The string constant must be contained by quotation marks. A plus sign is used to concatenate the text objects.

EXPRESSION: "Total Sales: "+Amount

This example will print the words "Total Sales" and a colon and the value in the Amount column.

SAMPLE LABEL:

Total Sales: 345215

2. A multiple line label can be created by adding a carriage return to the expression at the point where it is desired that the next line is to begin. The carriage return is represented as CHR$(13) in an expression.

EXPRESSION: Name+chr$(13)+Amount

This example will print the name value with the amount value directly under it.

SAMPLE LABEL:

Joe
67462

3. The two techniques above can be combined to form very descriptive labels.

EXPRESSION: "Name: "+Name+chr$(13)+" Sales: "+Amount

This example demonstrates one method of combining plus signs and carriage returns in an expression.

SAMPLE LABEL:

Name: Cindy
Sales: 758412

More information about creating expressions can be found in the MapInfo User's Guide.

Last Modified: 03/29/2001 01:10:11 PM
Document URL: http://testdrive.mapinfo.com/techsupp/miprod.nsf/kbase_by_product/2DDEC1D4C3FB08A78525654D006D6CC8

Using expressions for labeling.^2DDEC1D4C3FB08A78525654D006D6CC8^Y