How to get the value of a data element from the oldest event for a program stage

This might be a vague question but i was wondering if anyone has tried to get the value of a data element from the oldest event from a program stage using a program rule or program rule variable.


1 Like

Hi there @paleu256,
Some have a baseline program stage, where the first value is collected. If this is the case, you can use the source type “Data element for the newest event for a program stage”, and selecting the first program stage.

Otherwise you would have to create a rule that stores the first value in a separate helper field when it is first entered.

You could also send us a jira ticket on and describe your use case - and we can look into building either a function or source type to accomodate the use case.

Best regards,

1 Like

Hi @Markus and @paleu256,

I’m having the same challenge. In my case, I have a repeatable stage where I store a value in each event and I would like to subtract the first and last event of that stage and assign it to another DE. In order to get the first (oldest) event I was thinking on having a PR that populates a PR variable. Then, when it comes to define the condition… I don’t have a clear idea. The most accurate condition I found was that the v{event_count} equal to 1 but still not perfect since one could start entering data from another stage.