6

I hope to make a simple action in QGIS, where the field in my layer column "Process" can change from "NULL" to "Finished". I use hotlink to click on the polygon in the layer, where I want the action to be.

I tried to do use type Generic and

[%Process%]=substr('Finished',0,10)

but this did not work.

I hope somebody can help me.

7

If you change the Type from Generic to Python, you could use the following instead:

layer = qgis.utils.iface.activeLayer()
layer.startEditing()
idx = layer.fieldNameIndex('Process')
layer.changeAttributeValue([% $id %], idx, 'Finished')
layer.commitChanges()

Before you run your action, you will need to select it from the Layers Panel


Example:

  1. Setting up the action:

    Setting action

  2. Running action from Identify Features tool by clicking on it:

    Running action

  3. Result - value changed from Processing to Finished:

    Result


Also tested successfully with Hotlink.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.