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

column indexing issue with joined tables #16287

Closed
qgib opened this issue Mar 3, 2013 · 6 comments
Closed

column indexing issue with joined tables #16287

qgib opened this issue Mar 3, 2013 · 6 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!

Comments

@qgib
Copy link
Contributor

qgib commented Mar 3, 2013

Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV)
Original Redmine Issue: 7271
Affected QGIS version: master


I've spotted a pretty serious bug with joined columns in the attributes table window and symbology classification. Basically, all of the columns following the column which is used to join two tables will be wrongly indexed by not taking into account the removed column which was joined.

Shapefile Table:
id | name | date

To be joined by this XLS Table:
shared_id | extra_a | extra_b | extra_c

When joined, the resulting table would be:
id | name | date | extra_a | extra_b | extra_c

The shared_id column is merged with id, and therefore doesn't show. What seems to happen however is that the QGIS' table column index still takes into account shared_id. So when the user open the attribute table window and try to sort extra_a by clicking on its header, it'll end up sorting extra_b as the extra_a header refers to an index which takes into account shared_id.

Similarly, when doing symbology's graduated / categorized classification by selecting a joined column, the same shift happens.


@qgib
Copy link
Contributor Author

qgib commented Mar 3, 2013

Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV)


  • 5379 was configured as v4_CAM_HeadCount_MotherTongue_Multilevel_Census2008.xls

@qgib
Copy link
Contributor Author

qgib commented Mar 3, 2013

Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV)


  • 5380 was configured as Villages_point.zip

@qgib
Copy link
Contributor Author

qgib commented Mar 3, 2013

Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV)


Practical example with steps to reproduce issue:

  1. Open villages_point.shp (projection is indian 1960 48n, but it's irrelevant to this issue)
  2. Open v4_CAM_HeadCount_MotherTongue_Multilevel_Census2008.xls, and select the "By Village" layer
  3. Open the village_point property window and enter the joins tab
  4. Click on the [+] button to add a join as such: join layer "By Village", join field "Code_Phum_STRING", target field "VILL_CODE"
  5. Apply the join and leave the property window by clicking on ok.
  6. Open village_point's attribute table, and go to the end of the columns to view the joined columns, make sure row 0 is at the top.
  7. Click on the "By Village_Por" column header twice (to sort by highest to lowest number)

At that stage, you should clearly see the sorting occurs not the header your clicking but the one to its right, that is "By Village_Suoy" in this specific case.

@qgib
Copy link
Contributor Author

qgib commented Mar 6, 2013

Author Name: Minoru Akagi (@minorua)


"pull request 452":#452 will fix this issue.

@qgib
Copy link
Contributor Author

qgib commented Mar 31, 2013

Author Name: Minoru Akagi (@minorua)


Fixed in changeset "3959f94f8c1db15273d6acc5696bb94405129f24".


  • status_id was changed from Open to Closed

@qgib
Copy link
Contributor Author

qgib commented Mar 31, 2013

Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV)


Minoru, thanks for working on fixing this issue. I will test out the committed patches.


  • resolution was changed from to fixed
  • done_ratio was changed from 0 to 100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!
Projects
None yet
Development

No branches or pull requests

1 participant