I created a field to display the whole route of several photos in a point layer in order to be able to visualize them on the map. I try to do so by using this expression:
concat('C:\Users\DIDAC\Documents\CONSULT\EIA OLIVERES CLARAMUNT\treball camp\fotos\IGN\',"file_name")
"file_name" being the name of every photo.
Here's the error message: "syntax error, unexpected Unknown_CHARACTER"
csk
25.4k3 gold badges36 silver badges74 bronze badges
-
1Are you using this expression in the Field Calculator, or typing it directly into the attribute table?csk– csk2019年02月07日 19:11:20 +00:00Commented Feb 7, 2019 at 19:11
1 Answer 1
Backslash characters need to be escaped in qgis expression strings. Replace each backslash in the path with a double backslash '\'.
answered Feb 7, 2019 at 21:46
-
So would the final expression look like
concat('C:\\Users\\DIDAC\\Documents\\...
?csk– csk2019年02月07日 21:57:00 +00:00Commented Feb 7, 2019 at 21:57 -
Correct. The \ character is used to begin other "special" characters, like a
\n
= newline character. To get an actual \ literal you need to use `\`. (This is the same rules as Python or SQL languages)ndawson– ndawson2019年02月07日 22:40:24 +00:00Commented Feb 7, 2019 at 22:40