Jump to content

 
Photo

Character Selections in Illustrator & Mapublisher 8.5

- - - - -

  • Please log in to reply
4 replies to this topic

#1
ELeFevre

ELeFevre

    Hall of Fame

  • Associate Admin
  • PipPipPipPipPipPipPip
  • 1,050 posts
  • Gender:Male
  • Location:Louisville, Colorado USA
  • Interests:Cartography, Music, GIS, Coffee
  • United States

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



#2
Claude

Claude

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 107 posts
  • Location:Denver, CO
  • United States

That Lydia Lunch, man...she could really rock some SQL queries.
Platts, a div. of McGraw-Hill
www.maps.platts.com


#3
sitesatlas

sitesatlas

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 184 posts
  • Gender:Male
  • Location:Madrid, Spain
  • Spain

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...
Michael Borop
World Sites Atlas
http://www.sitesatlas.com

#4
Jacques Gélinas

Jacques Gélinas

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 105 posts
  • Gender:Male
  • Location:Gatineau (Québec)
  • Canada

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,

Jacques Gélinas
cartographer
www.cartesgeo.ca


#5
Gord D

Gord D

    Newbie

  • Validated Member
  • Pip
  • 9 posts
  • Gender:Male
  • Location:Penetanguishene, Ontario, Canada
  • Canada

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->