Hi guys,
I'm running into this error since a bit now and it is understandable as to why it might be the case but I would like to get some ideas to resolve this or work around this if possible.
Concept :
Field value gets changed/edited through the survey ->
Edited value gets appended into a text field (to keep track of the change) ->
Another field counts how many values are in the text field and reports that.
E.g.:
Existing Value - 2020
Changed Value - 2021
History 2020,
Count 1
Changes again :
Value - 2022
History - 2020, 2021,
Count - 2
I was able to get this working with attribute rules, the js can also do this but since all of these fields are depended on each other to work it is causing a
"Dependency cycles amongst the xpath expressions in relevant/calculate\n\nResult: Invalid"
The values in the first field is pulled from a feature class using pulldata
| integer | Last_Preservation | Last Preservation (Pulls Data from a featureclass) |
| text | History | History (Keeps track of the changes) |
| integer | PRound | Preservation Count (Counts the Changes, String) |
JS - Sample to get a gist of what the process is with Javascript.
// historyUpdater.js
// Function to update the History field with new values
function updateHistory(lastPreservation, currentHistory) {
if (!lastPreservation) return { "updatedHistory": currentHistory || "" };
let historyEntries = currentHistory ? currentHistory.split(", ") : [];
let lastEntry = historyEntries[historyEntries.length - 1];
// Append new entry only if different from the last entry
if (lastPreservation.toString() !== lastEntry) {
return { "updatedHistory": currentHistory ? currentHistory + ", " + lastPreservation : lastPreservation.toString() };
}
// Return original history if no update is needed
return { "updatedHistory": currentHistory };
}
// Function to count the number of entries in the History field
function countHistoryEntries(history) {
if (!history) return { "PRound": 0 };
let historyEntries = history.split(", ");
return { "PRound": historyEntries.length };
}
What would be another way to achieve this result?
Why does the condition says cyclic when the change triggers the rest and it ends, when It does not cycles back.

How it is supposed to work in theory. It does not have to show the other two fields,
For visualization only.
Thank you.