Incremental field

Hi all,

I would like to assign an incrementor to a data element automatically each time an event is created in a repeatable stage. i.e., create a counter. Starting with ‘1’ and incrementing by 1 each time a new event is created. I know this can be done using a program rule, but I have no idea how to build it, so I am asking anyone from the community for a step-by-step guidance.


1 Like

Hi @dmbantu!

One way to do it is by using the variable type “Data element from previous event”:

  1. Create the variable

  2. Create a rule that assigns “1” to the first event

  3. Create a rule to assign the value for all the other events


I’m attaching a JSON file and you can test it on a play server.

There is probably other ways to create this rule but hope this gives you an idea.
metadata.json (21.6 KB)


Hi @nancyesp,

Both program rules work, but the first program rule is not triggered immediately.


For it to be triggered, I must click on the program stage after selecting the report date. Is there any problem?


I believe it is just the workflow. The event must be “open” to run the rule.

1 Like

Hi @nancyesp,

I didn’t get the message.


Hi @dmbantu, sorry for the confusion.

I thought, the event didn’t have the “open” status but you are right, with auto-generated events it looks like the event is not updated until you double click on it. This doesn’t happen if the events are created manually rather than automatically.

I suggest to open a jira ticket.

1 Like