Error editing the event, the changes made were not saved

Hi Everyone,

I have a challenge where I’m unable to complete an Event program. I got an error: “Error editing the event, the changes made were not saved
I’ve identified the problem with a PR (program rule) that calculates and assigns a value to a data element - see attachment:

When I remove the PR, the error disappears, but we need the PR for the calculation.

Program rule:
Name: IR01_048: Assign room 1 Total Corrected % mortality

PR Expression: d2:hasValue(Room 1 Top Cone - # Dead at 24/48/72 hrs) && d2:hasValue(Room 1 Top Cone - # Mosquitoes) && Room 1 Top Cone - # Mosquitoes > 0 && (d2:hasValue(Control - # Dead at 24/48/72 hrs) && d2:hasValue(Control - # Mosquitoes) && Control - # Mosquitoes > 0)

Action: Assign value to data element: “Corrected mortality”

Expression to evaluate and assign:
(((#{IR01room1TopConeDead24_48_72H} + #{IR01room1MiddleConeDead24_48_72H} + #{IR01room1BottomConeDead24_48_72H}) / (#{IR01room1TopConeMosquitoes} + #{IR01room1MiddleConeMosquitoes} + #{IR01room1BottomConeMosquitoes})) - ((#{IR01control1TopConeDead24_48_72H} + #{IR01control1MiddleConeDead24_48_72H} + #{IR01control1BottomConeDead24_48_72H}) / (#{IR01control1TopConeMosquitoes} + #{IR01control1MiddleConeMosquitoes} + #{IR01control1BottomConeMosquitoes}))) / (1 - (#{IR01control1TopConeDead24_48_72H} + #{IR01control1MiddleConeDead24_48_72H} + #{IR01control1BottomConeDead24_48_72H}) / (#{IR01control1TopConeMosquitoes} + #{IR01control1MiddleConeMosquitoes} + #{IR01control1BottomConeMosquitoes})) * 100

**“Corrected mortality”
Data element value type = number
Data element Agg type = Average

DHIS tested versions: v40.3.2 & v40.11

Please let me know if you need more information.

Thanks
@Hans_Naude / @Elmarie_Claasen / @Mahlatse_Mokoena1

Hi @Johan_Smith

Why is it trying to assign a value when it already has a value? So the point here is not to set a value but to actually update/edit the value?

There’s a rule that says: * When the action is assigning a value to an attribute/data element that already has a value and the value to be assigned is different, an error is generated unless the RULE_ENGINE_ASSIGN_OVERWRITE system setting is true." (source)