Expressions in MAPublisher #
A group of snippets to help you manipulate attributes in MAPublisher
Select Empty Fields #
The key here is to have an empty space between the quote marks
COLUMN_NAME=" "
Concatenate two fields #
Make a new, empty field with the type you want (string/text), and using the ‘Apply Expression’ option from the MAP Attributes panel menu, this will merge ‘column1’ and ‘column 2’ with a space in between and save it as the value in the newly created column.
(column 1)& " " &(column 2)
Edit Schema to format text #
I use this whenever want to generate labels from a contour line dataset. I want to label without commas “,” in the number, but they typically come in from the GIS as an integer, so they are formatted with commas. It is as simple as setting the column type to a string.
- From the MAP Attributes menu, select ‘Edit Schema’
- Select the field you want, and set the field type to String
- The field is now ready to generate labels from without commas.
Find/Replace/Append #
From time to time I need to edit attributes in the MAPublisher MAP Attributes table. Typically this is for formatting the names of features before generating labels. This example is working with the WPDA dataset and labeling a subset of the polygons. In this case I wanted to label all of the National Parks. Some of the values in the NAME field had “National Park” somewhere in the name, sometimes at the beginning, sometimes at the end.

Attributes in Question: Some values have “National Park”, others don’t
So, we need an expression that looks to see if the string “National” exists. If it does, leave the NAME value alone, if it doesn’t, then append “National Park” to the end of the existing value. Without further ado, the expression:
IF(CONTAINS(NAME,"National"),NAME,NAME & " " & "National Park")
This expression says:
- If the value in NAME contains “National”…
- then replace with NAME (ie-leave it alone),
- if it doesn’t contain “National”, replace the value with the existing NAME value and append the string “National Park”.
Apply the expression via the “Apply Expression” option in the flyout menu of the MAP Attributes table:
And the features in question have the correct string, “National Park”, applied to them:
