1

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
asked Feb 7, 2019 at 19:01
1
  • 1
    Are you using this expression in the Field Calculator, or typing it directly into the attribute table? Commented Feb 7, 2019 at 19:11

1 Answer 1

2

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
2
  • So would the final expression look like concat('C:\\Users\\DIDAC\\Documents\\...? Commented 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) Commented Feb 7, 2019 at 22:40

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.