[Qgis-user] Action in Qgis

Piotr Kania p.kania at op.pl
Mon Apr 18 12:18:12 PDT 2016


Here:
http://qgis.pt/blog/2014/06/18/accoes-em-python-no-qgis/

I found nice example of qgis action, I tried to use it in qgis, but it 
doesn't work:

NIF = '[% "NumContrib" %]';
nomeLayer = u'Situacao Actual - Props. e Predios'
tab = QgsMapLayerRegistry.instance().mapLayersByName(nomeLayer)[0];
#selecao per atributo;
sFilterExp = u'"NumContrib" = %s' % NIF;
it = tab.getFeatures(QgsFeatureRequest().setFilterExpression (sFilterExp 
) );
tab.setSelectedFeatures( [f.id() for f in it ] );

Can someone explain how to adjust it? It should select all clicked 
values in attribute table





More information about the Qgis-user mailing list