Hi all,
I'm working with an attributed label layer in MP and Illustrator. Using an expression, is it possible to select a certain number of characters at either the beginning or the end of the string?
For example, if I have a label that looks like this: Death Valley (69) Is there a way to select the last four characters...(69)?
Possible?
Erin
Character Selections in Illustrator & Mapublisher 8.5
Started by
ELeFevre
, Jun 29 2011 04:39 PM
4 replies to this topic
#1
Posted 29 June 2011 - 04:39 PM
#2
Posted 29 June 2011 - 04:48 PM
That Lydia Lunch, man...she could really rock some SQL queries.
Platts, a div. of McGraw-Hill
www.maps.platts.com
www.maps.platts.com
#3
Posted 29 June 2011 - 07:31 PM
If you want to create a column in the attributes with the last characters in a string, you'll need the function RIGHT. For example, if "Death Valley (69)" is in the PLACE field, go to Apply Expression in the MAP Attributes panel, select the column where you want the results to go, and enter RIGHT(PLACE,4) in the Expression window to grab the last four characters from the PLACE field.
EDIT: Oops -- I just noticed you want to select within labels that have already been created, not modify the attribute table. Hmm, I have no idea how to do that...
EDIT: Oops -- I just noticed you want to select within labels that have already been created, not modify the attribute table. Hmm, I have no idea how to do that...
#4
Posted 30 June 2011 - 12:23 PM
I just tested Micheal's solution and it seems OK.
If your layer is a text layer then, I would create a new field e.g. CODE (string length 4) for that layer.
Select the desired elements on your text layer and apply the following expression on the CODE field.
RIGHT(#text,4)
The resulting CODE field should now be populated with the last four characters of the #text field...
Not sure if that is what your are looking for?
Regards,
If your layer is a text layer then, I would create a new field e.g. CODE (string length 4) for that layer.
Select the desired elements on your text layer and apply the following expression on the CODE field.
RIGHT(#text,4)
The resulting CODE field should now be populated with the last four characters of the #text field...
Not sure if that is what your are looking for?
Regards,
Jacques Gélinas
cartographer
www.geographicMAPS.ca
#5
Posted 04 July 2011 - 11:58 AM
MAPublisher's expression builder also supports REGEX string parsing, which can be used for many different types of substring selection.
This expression returns the brackets and any two digit values between them, wherever they occur in a string in the Street field:
REGEX(Street,"[(]\d\d[)]")
However, if you knew that some of your values contained three digits between the brackets, you could simplify the expression to:
REGEX(Street,"[(]*[)]")
which will return the brackets and a substring of any length between them from anywhere in the string.
Regards,
Gord
This expression returns the brackets and any two digit values between them, wherever they occur in a string in the Street field:
REGEX(Street,"[(]\d\d[)]")
However, if you knew that some of your values contained three digits between the brackets, you could simplify the expression to:
REGEX(Street,"[(]*[)]")
which will return the brackets and a substring of any length between them from anywhere in the string.
Regards,
Gord
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users


Sign In
Create Account

United States
Back to top
Spain
Canada








