[Qgis-user] nested loop using nextFeature() invalidates the outer dataProvider cursor

InterRob rob.marjot at gmail.com
Wed Sep 5 13:59:23 PDT 2012


Dear list,

I intend to do the following:

first.select(first.attributeIndexes())
while first.nextFeature(ft1):
  sVal = str(ft1.attributeMap()[someIndex].toPyObject())
  second.setSubsetString("mycol = " + sVal)
  second.select(second.attributeIndexes())
  while second.nextFeature(ft2):
    self.doSomething(ft2)

Both "first" and "second" are valid data providers between two different
layers.

It seems like the inner select() / nextFeature() pattern invalidates the
outer? Is this is a cursor issue? It seems to me that QGIS has only one
built-in cursor?

Hope you can provide me with some insights here.

Kind regards,
Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20120905/99cb41fe/attachment.html>


More information about the Qgis-user mailing list