I'm attempting to copy just the numeric portion of a street address into a new table using the Field Calculator in QGIS. The expression I'm trying to use is:

left( "SITE_ADDR", strpos( "SITE_ADDR", " " ) -1)

strpos is giving an invalid expression error- column " " not found.

Is there another way to format this expression to actually work?

  • 1
    What does your site_addr value look like? – Nathan W Nov 25 '14 at 22:57
  • Can you give examples of the 'from' data? – Michael Stimson Nov 25 '14 at 22:59

I believe your expression should be:

left( "SITE_ADDR", strpos( "SITE_ADDR", ' ' ))

Note single quotes around string, do not need to minus 1.

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.