[Qgis-developer] problem with forms and python init

Enzo Ciarmoli enzo.ciarmoli at csi.it
Fri Dec 20 15:55:39 PST 2013


> > nevertheless the problem remain the same: if i try to load the data
> > from a table without geometry, values for i.attributes()[1] remain empty.

Hi Luca,
I tried your sample code and it works... I don't know what's wrong in your
situation...

If your problem remain the same,
I could suggest you to use QgsFeatureRequest with NoGeometry flag

(see Detailed Description in:
  http://www.qgis.org/api/classQgsFeatureRequest.html )

Example:
layer = QgsMapLayerRegistry.instance().mapLayersByName('your_table')[0]
iter =
layer.getFeatures(QgsFeatureRequest().setFlags(QgsFeatureRequest.NoGeometry))

for feat in iter:
    print feat.attributes()
    print feat.attributes()[0]
    print feat.attributes()[1]


Ciao!

Enzo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131221/397cd8e4/attachment.html>


More information about the Qgis-developer mailing list