Hello, currently I have a project that sequentially numbers the markings of points I make. The numbering depends on the SER, which means that the expression counts the existing points of the SER that I enter in the form and adds them up, as shown in the attached expression. This expression works perfectly, but the problem arises when I need to modify a point. When I modify it, it counts all the existing points and adds 1 to the count. I tried disabling the default value checkbox, but when I do that, the formula stops working. It only works when the default value checkbox is activated.:
This is the expression I am using:
with_variable(‘count_infra’, aggregate(layer:=‘AGREGARINFRAESTRUCTURA’, aggregate:=‘count_distinct’,expression:=“CONSECUTIV”,filter:=“SER”=attribute(parent, ‘SER’)),count_infra)+1
Imported from GitHub discussion by @CACG1022 on 2023-06-10T15:42:50Z