[Qgis-developer] Re: [Qgis-user] Query a joined layer

Marco Hugentobler marco.hugentobler at sourcepole.ch
Fri Nov 4 08:50:06 EDT 2011


> I think the problem might be that the query builder, when you press ok, is
> setting the the layer subset via QgsDataProvider::setSubsetString(string).
> How setSubSetString works is up to the provider. In your case the provider,
> that you joined to, doesn't know anything about the other fields or how to
> filter based on them so it just returns nothing.

Aha, it is still possible to open the query builder for joined layers with the 
right click menu. Needs to be greyed out for joined layers as in the vector 
properties.

Regards,
Marco

Am Freitag, 4. November 2011, 13.37:31 schrieb Nathan Woodrow:
> Hey James,
> 
> I think the problem might be that the query builder, when you press ok, is
> setting the the layer subset via QgsDataProvider::setSubsetString(string).
> How setSubSetString works is up to the provider. In your case the provider,
> that you joined to, doesn't know anything about the other fields or how to
> filter based on them so it just returns nothing.
> 
> QGIS itself doesn't have a SQL engine in it's own right all most everything
> with querying, except for the basic stuff, is passed to the provider. I
> have had a chat to a few of the devs and it is something I am considering
> if and how it could be added to QGIS. Not something that I myself will be
> able to do, way over my head, but more just getting the ideas out there and
> maybe some will fund it.
> 
> Hopefully this will at lest let you understand what is happening.
> 
> - Nathan
> 
> On Fri, Nov 4, 2011 at 10:01 PM, James Stott
> 
> <James.Stott at npaconsult.co.uk>wrote:
> > I have opened an Access table via an ODBC connection. This has allowed me
> > to open the attribute table up in QGIS. I have then done a join to join
> > my attribute and polygon data together. I can style the data using the
> > joined fields, and they all show up in the attribute table and the
> > identify tool. However I cannot use these fields in a query. ****
> > 
> > ** **
> > 
> > If I use the query builder the fields show in the fields list, and the
> > values from the fields show in the field list. However all of my queries
> > return no results.


-- 
Dr. Marco Hugentobler
Sourcepole -  Linux & Open Source Solutions
Churerstrasse 22, CH-8808 Pfäffikon SZ, Switzerland
marco.hugentobler at sourcepole.ch http://www.sourcepole.ch
Technical Advisor QGIS Project Steering Committee


More information about the Qgis-developer mailing list