3

I have a column called Hotlink full of incorrect directories and I need to edit them.

They currently read C:/ABCD/filename.pdf and I want them to read C:/Maps/ABCD/ABCD/filename.pdf

The script I'm trying to use but not having much luck with is as follows: replace ("Hotlink", '(ABCD)', '(Maps/ABCD/ABCD)');

How can I get this to work?

6
  • maybe try replace ("Hotlink" , 'ABCD' , 'Maps/ABCD/ABCD') – ed.hank Feb 1 '16 at 15:45
  • I still get the errors, Parser Error: syntax error, unexpected Unknown_CHARACTER, expecting $endEval and Error: No root node! Parsing failed? Thanks for the suggestion though! – Paul Feb 1 '16 at 15:48
  • it may not like those / characters... let me do a little research, its been awhile since i used qgis – ed.hank Feb 1 '16 at 16:03
  • try this replace ("Hotlink" , 'ABCD' , 'Maps\\ABCD\\ABCD') see esdm.co.uk/qgis-field-calculator-backslash-gotcha – ed.hank Feb 1 '16 at 16:06
  • That works! I appreciate all your help! – Paul Feb 1 '16 at 16:27
2

So we have a definite answer to the question:

The problem involves QGIS not liking the backslash

try this

replace ("Hotlink" , 'ABCD' , 'Maps\\ABCD\\ABCD')

see esdm.co.uk/qgis-field-calculator-backslash-gotcha

1
  • replace ( "Hotlink" , 'ABCD', 'Maps/ABCD/ABCD') and replace ("Hotlink", '(ABCD)', '(Maps/ABCD/ABCD)') works for me. The solution of ed.hankins is for Windows paths. Here Paul use the Unix path. – gene Feb 1 '16 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.