I created an attribute rule with the triggering event "Update" in an attempt to obtain the number of records for the feature class.
the code is this:
return{"errorMessage" : "An "+count(FeatureSetbyName($datastore, "Room"))}
whenever I update any records on the table, the count of records is the actual number plus one.
Solved! Go to Solution.
Guess I should have payed more attention to the original post. I had Insert enabled on the tool, so was a bit different.
Even so, I was not able to reproduce with just update, and was still geting the correct count (testing with data from SQL server EGDB):
However, when testing with the same feature class/attribute rule exported to a FGDB feature class:
I am then consistently getting the actual count + 1 as you are seeing. So, since they report different values from the same rule/data, just different sources, I'd suspect you have discovered yet another bug.
Might want to start a tech support request so that this issue might get addressed.
R_
Maybe run the check geometry tool and see if there is a invalid geometry or something.
I get the exact count using your code in 2.9.3 and 3.1.1
R_
Actually, on second thought, I think it is working as expected. If you have 8 values in there already, then try to add one, it should be number 9. However, since it is showing as error message, it is what "would" be there if it were to create the feature (since feature isn't created on error).
Perhaps try updating the field instead of returning an erromessage and see if that "fixes" it:
count(FeatureSetbyName($datastore, "Room"))
R_
Greetings, Rhett Zufelt
First of all, I appreciate your reply. There are no flaws in the records' geometry, which was your initial concern. It is therefore illogical for the case, I am displaying on this case to have nine records because I am updating one of them not adding a new one. The error message just informs me of the count's value before continuing with other procedures.
Before counting the records, I simply need to apply a filter, however, I'm not sure why this issue is occurring.
Count(Filter(FeatureSetbyName($datastore, "Floor"),"1 = 1"));
Guess I should have payed more attention to the original post. I had Insert enabled on the tool, so was a bit different.
Even so, I was not able to reproduce with just update, and was still geting the correct count (testing with data from SQL server EGDB):
However, when testing with the same feature class/attribute rule exported to a FGDB feature class:
I am then consistently getting the actual count + 1 as you are seeing. So, since they report different values from the same rule/data, just different sources, I'd suspect you have discovered yet another bug.
Might want to start a tech support request so that this issue might get addressed.
R_