3

i tried to do some queries on joiend table fields ...

i've got/found some answers concerning version 1.8 - which result in "use select + export to create a combined dataset" so i just did some tests with Layer / query in qgis 2.2 valmiera and 2.3-master(build from 2014-05-02)) and ended up with the same problems:

while

  • "layer properties / style / column expression" tool is working fine based on "external" fields - even if i build complex expressions

  • and "table - select faetures by expressionn" doesn't seem to have any problems with where-clauses

"layer / query" returnes strange results with my demo-data; i.e.:

  • no problems with expressions unsing fields from the layer's attribute table
    but - as soon as i address "external" fields
  • but - as soon as i address "external" fields

    • the test feature returns an error: a simple query like "zsp_experimente_xls_WFL01_AREA" >= 1.52" (where 1.52 is valid value out of the sample-list) returns
      "OGR 3 error 1: type mismatch or improper type of arguments to >= operator"

      but "zsp_experimente_xls_WOHNFL01_AREA" LIKE "%" returns all records when testing the query ("the where clause teturned 1364 rows")
    • the confusing thing about that:
      the the sample tool privides correct results ! ! !
      ((which means to me that the select part of the statement works fine))

so finally i am still argueing that one of the essential benefits of the join-concept is, that you do not have to mix up geometry and attribute data -> which was a really great idea !!!!!!!

to select data by expression and export geometry and "added" additional data really undermines this concept by duplicating data !!!

Does anybody have any idea how to deal with that problem ?

  • Could you please clarify what exactly you are trying to achieve? I understand that you want to join, filter, and then export data but I cannot quite follow what you would like to export since the thread reads "export geometry and "added" additional data really undermines this concept by duplicating data" – underdark May 7 '14 at 10:35
  • i'd like to do queries on fields from joined tables directly - which obviously is not working properly (as i tried to show with the given examples) – robert tuw May 7 '14 at 15:54
  • ... missed the 5 minutes limit: i'd like to do queries (layer/query) on fields from joined tables directly - which is not working properly (as i tried to show in the examples) <br> about 1 year ago sombody suggested to do a select (select features by expression) instead of using layer/query + export the resulting selection to a new shape-file... which of course would work but foils the concept of joining attribute data <br> (since select features and the "sample tool" within query-dialog return proper results i was wondering, that there still seems to be no way to do query on joind fields) – robert tuw May 7 '14 at 16:03
1

Queries entered in layer properties | general | feature subset are passed to the GDAL/OGR data provider. Now, this data provider does not have any clue about joins which have been set up in QGIS. That's why it cannot access fields from joined layers.

You already know the work-around (saving and working with the new dataset or adding filters to the renderer instead of to the layer), so there is really not much more to say than that you can open a feature request. Also, if you can chose to work with databases tasks like this would be simpler.

  • ...the problem with exporting the new dataset (as shp) is, that any of the field names are changed/destroyed (since they are automatically generated from table-name + field-name of the joined table) ... so especially for new users (students) this is pretty confusing. and there is as far as i know no simple workaround for renaming fields without using field-calk – robert tuw May 7 '14 at 16:07
  • Renaming is simple using Table Manager plugin. I agree that exporting to shp has its downsides. – underdark May 7 '14 at 16:08
  • ... thx for the table manager plugin !!! – robert tuw May 7 '14 at 16:22
  • ... table manager: looks as if the table manager is not able to manage plain dbf-tables. do you know a tool that comes along with shps and dbf. thx in advance ! – robert tuw May 8 '14 at 8:38
  • 1
    With QGIS 2.8 you can manually assign a custom prefix (which can be empty) instead of the table name when joining fields. – Matthias Kuhn Apr 18 '15 at 16:14

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.