Pitney Bowes
MapInfo Pro™ Monthly Journal
Something a bit more advanced - Conditional Labelling with MapInfo Professional
adv

MapInfo Professional does not provide a direct way to label just those records that meet a certain condition. A commonly used workaround is to create a subset (i.e. selection or query) from the table with the desired items to be labelled. The query is added to the map as its own layer and then labelled.

There is a way to do conditional labelling without creating a query. The trick here is to use a label expression that incorporates a condition within the Int() function. The expression will yield a result of zero or 1 and this result will control whether or not a label will appear for any given item in the map.

The following are some examples:

Given a field containing numeric values, the following expression will avoid labelling any value that is zero: 

Left$ ( Str$ (COLUMN_NAME ) , Int (COLUMN_NAME > 0 ) * Len ( Str$ (COLUMN_NAME ) ) ) 

The technique mentioned above can be used in different ways. The following are two more examples:

1) The following expression will label any value above 50,000.

Left$ ( Str$ (COLUMN_NAME ) , Int (COLUMN_NAME > 50000 ) * Len ( Str$ (COLUMN_NAME ) ) )

2) Given a character column containing classified data ("type" data), you could avoid the labelling of one of the types. Let's say a set of points represents different types of medical practices. The types are GPs, paediatricians, cardiologists, neurologists, etc. The following expression will label all of the different types except for GPs. 

Left$ ( Str$ (COLUMN_NAME ) , Int (COLUMN_NAME <> "GP" ) * Len ( Str$ (COLUMN_NAME ) ) )

Finally, to label only the GPs, just change the <> expression to =

Left$ ( Str$ (COLUMN_NAME ) , Int (COLUMN_NAME = "GP" ) * Len ( Str$ (COLUMN_NAME ) ) )

map