Character problem when save map Atlas

by Diogo Caribé   Last Updated July 01, 2016 08:09 AM

I have 45 maps produced with Atlas. I would like to save them with their names. However, there are character in these names that windows doesn't accept in file name. So, I'm tring to do a expression which replace this kind of characters to "_". I am doing it in output file name expression (panel in Genarate an Atlas).

So, here is my code. It isn't work what I want.

a = lower("field_name")
b = '-/"()' #characters to replace -, ", ( and ).
for char in a:  
    a = a.replace(char, "_")
    'mapa_'||$feature||a


Answers 1


You can use a regular expression:

regexp_replace(  "your_attribute" , '[^A-Za-z0-9]+', '_')

This will replace all non-alphanumeric characters with an underscore.

Vesanto
Vesanto
July 01, 2016 12:32 PM

Related Questions


Name Active Layer in expression

Updated September 15, 2017 12:22 PM