[Qgis-developer] join table [SOLVED]

Siki Zoltan siki at agt.bme.hu
Thu Jan 3 12:25:03 PST 2013


Dear Developers,

the solution to my problem is not to use the dataProvider's methods, those 
handle only the columns of the original layer. The layers' methods should 
be used instead.
So if you would like get joined column values
use layer.pendingAllAttributesList() instead of dataProvider.attributeIndexes()
use layer.pendingFieldList() instead of dataProvider.fields()
use layer.featureAtId(...) instead of dataProvider.featureAtId(...)

The answer was found in qgisvectorfilewriter.cpp.

Best regards

On Tue, 1 Jan 2013, Siki Zoltan wrote:

> Dear QGIS DEvelopoers,
>
> I'm writing a python plugin where I would like to handle the values in a dbf 
> table which is joined to a shape file. I could join the table to the shape 
> file using VectorLayer.addJoin, but I can't find any way to get the joined 
> attributes of a feature. After joining the dataProvider.attributeIndexes 
> returns only the original columns of the shape file. The fieldNameIndex 
> returns -1 for all joined column names.
> Any advice to get the values in joined columns in Python?
>
> Thanks,
> Zoltan
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>


More information about the Qgis-developer mailing list