Still in process... Found a problem with changing all fields, not only the first one. Works perfectly in Python Console but behaves strange in
The function that solves your issue probably looks as follows. You just need to insert it into the
P.S. And do not forget to change the number that defines the column where your values are stored, i.e.
Define new functions using @qgsfunction. feature and parent must always be the
last args. Use args=-1 to pass a list of values as arguments
from qgis.core import *
from qgis.gui import *
def calculate_values(value, feature, parent):
layer = qgis.utils.iface.activeLayer()
sum_values = sum(filter(None,[f['Value'] for f in layer.getFeatures()]))
values_length= len(filter(None,[f['Value'] for f in layer.getFeatures()]))
if not layer.isValid():
raise Exception('Layer is not valid')
features = layer.getFeatures()
for feat in features:
attr = feat.attributes()
if attr == NULL:
I do have a layer that stores point objects.
The result of the function will give a certain output. However, it still requires adjustments.