Bug report #953

Actions fail getting columns with digits in their name

Added by Goyo D about 16 years ago. Updated over 14 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:Vectors
Affected QGIS version: Regression?:No
Operating System:All Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:11012

Description

Having real columns named like col1 and col10, %col10 gets the value of col1 and appends a '0'.

Detailed steps:

Create a point shapefile with two columns of tipe Real, named col1 and col10 (only the digits are relevant).

Create a point in that layer and give value 1 to col1 and 2 to col10.

Create an action for the layer, something like:

bash -c echo %col10

Identify the created point end execute the action. You get 10, this is the value of col1 plus a '0' appened.

Using binaries from the web in Ubuntu 7.10 (0.9.2 RC1) and Windows XP (0.9.1)

History

#1 Updated by gjm - over 15 years ago

The bug is not to do with column names with digits in their name, but rather having column names that are a substring of another.

How to deal with this? One could require each column name to be delimited by spaces (e.g., %col1 %col10 ). However this then prevents things like this: %colA_%colB, which can be quite useful. The algorithm that does the substitution is quite simple. Perhaps the ability to optionally quote column names would be enough to cope with the problem that causes this bug report?

#2 Updated by Goyo D over 15 years ago

I think any form of explicit delimitation of column names would be OK.

#3 Updated by gjm - over 15 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

Fixed in . Use square brackets around the field name to delimit it if necessary. For example, using [%col10] will prevent the %col10 field being treated as the %col1 field with a trailing 0. The user documentation has been updated (in ) to reflect this change. Use a second set of square brackets if you actually want square brackets around the substituted field (e.g., %col10 will yield [abcd] if %col10='abcd').

#4 Updated by Anonymous over 14 years ago

Milestone Version 1.0.0 deleted

Also available in: Atom PDF