Transaction-node needed?

I’ve made a script with Cpython3 in R22 to give every floorelevation an unique color.
The script removes old filterelements, create new ones and adds the filter to the current view.
The script works but gives an unexpected result. (see image1)

Somewhere goes wrong. The database is not updated. I think that I need to add a transaction-node on the right place.

Workaround: edit manually the filter and select the value in the list again. (see image2)
Endresult as expected. (see image3) This is what I want. But the script doesn’t do that for me.

Can anybody help me to modify the script and tell me where i need to put the transaction-node?


image1 (view with new filters that don’t work)


image2 (manually modify creates filter - reselect value)


image3 (view with filters that work)

R2022 2.12 v7 palenplan - inkleuren vaste grond.dyn (130.0 KB)
Project_R22_test_vloeren.rvt (1.1 MB)