4

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?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Paul
  • 53
  • 4
  • maybe try replace ("Hotlink" , 'ABCD' , 'Maps/ABCD/ABCD') – ed.hank Feb 01 '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 01 '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 01 '16 at 16:03
  • try this replace ("Hotlink" , 'ABCD' , 'Maps\ABCD\ABCD') see https://www.esdm.co.uk/qgis-field-calculator-backslash-gotcha – ed.hank Feb 01 '16 at 16:06
  • That works! I appreciate all your help! – Paul Feb 01 '16 at 16:27
  • I posted the answer below, if you can mark it correct when you can so others know we have the solution =) – ed.hank Feb 01 '16 at 16:41

1 Answers1

3

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

ed.hank
  • 3,862
  • 1
  • 14
  • 35
  • 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 01 '16 at 16:43