pyqgis filter using date column

المشرف العام

Administrator
طاقم الإدارة
In qgis python console I can run the following to extract the week number from date column. How can I use the same in qgsExpression as a where clause. Any other option is welcome as long as it uses pyqgis. I intend to filter a vector layer in qgis to return records that match a particular week.

for x in layers: if x.name() == "test": idx = x.fieldNameIndex("date_from") values = x.uniqueValues( idx ) b =values[0] print b.weekNumber() b.weekNumber()[0] This expression gives me an indication of the week number. Can I use QgsExpression like
expr = QgsExpression( "\"date_from.weekNumber()\" = 99" )



أكثر...
 
أعلى