Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QGIS saves integer field when I create a new real field through field calculator (Update field works as intended) #26880

Closed
qgib opened this issue May 28, 2018 · 4 comments
Labels
Attribute Table Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Regression Something which used to work, but doesn't anymore

Comments

@qgib
Copy link
Contributor

qgib commented May 28, 2018

Author Name: Stefan Newluck (Stefan Newluck)
Original Redmine Issue: 19050
Affected QGIS version: 2.18.2
Redmine category:attribute_table
Assignee: Alessandro Pasotti


Problem:

When I create a new real field from within field calculator and calculate a decimal value, it is displayed correctly until I hit save. After save the field is saved as integer.

Please see the attached screenshot for an illustration.

What should happen:

The field should of course stay real.

Workaround:

Hit "Create field" and create a real field there. Then open field calculator and calculate decimal values into that field by updating it. Hit save and the field stays real.

Steps to reproduce:

  1. Download this open data shapefile that I just use to confirm this bug: http://data.statistik.gv.at/data/OGDEXT_POLBEZ_1_STATISTIK_AUSTRIA_20180101.zip
  2. Open the shapefile's attribute table and start editing
  3. Create a dummy integer field
  4. Open field calculator and calculate a new field with the ratio of the two integer fields
  5. Save the table
  6. The real field turns into integer.

@qgib
Copy link
Contributor Author

qgib commented Jun 1, 2018

Author Name: Alessandro Pasotti (@elpaso)


I reproduced the issue, it looks like this is due to the "Output field length" value which is set to 0 by default when adding the field from "Create field" while the default is 10 when created from the calculator.

Can you please confirm my findings?


  • assigned_to_id was configured as Alessandro Pasotti

@qgib
Copy link
Contributor Author

qgib commented Jun 1, 2018

Author Name: Alessandro Pasotti (@elpaso)


Requires backport

#7143


  • regression was changed from 0 to 1
  • resolution was changed from to fixed/implemented
  • pull_request_patch_supplied was changed from 0 to 1
  • status_id was changed from Open to In Progress

@qgib
Copy link
Contributor Author

qgib commented Jun 2, 2018

Author Name: Stefan Newluck (Stefan Newluck)


Alessandro Pasotti wrote:

I reproduced the issue, it looks like this is due to the "Output field length" value which is set to 0 by default when adding the field from "Create field" while the default is 10 when created from the calculator.

Can you please confirm my findings?

Exactly this is the difference. If I set the "Output field length" to 0 in field calculator, decimal values are stored correctly upon save.

Thank you for looking into it! I'm looking forward to testing the fix. :)

@qgib
Copy link
Contributor Author

qgib commented Jun 2, 2018

Author Name: Anónimo (Anónimo)


Applied in changeset 033071a.


  • status_id was changed from In Progress to Closed
  • done_ratio was changed from 0 to 100

@qgib qgib closed this as completed Jun 2, 2018
@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Attribute Table Crash/Data Corruption Regression Something which used to work, but doesn't anymore labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Attribute Table Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Regression Something which used to work, but doesn't anymore
Projects
None yet
Development

No branches or pull requests

1 participant