Dynamic calculation

Hi all,

I am seeking help. I want to register child’s age in months and see age change over time. I mean if I register a child’s age in months today to be 2 months, two months later I want it to be 4 months , and so on… How can I do this?

Thanks

3 Likes

Hi @hernandezmachava,
What are you trying to build?
Program Indicador or Program Rule.

1 Like

Hi @asacur,

I am trying to build a program rule.

Thanks

1 Like

Hi @hernandezmachava,
Thanks for the program rules exercise! :smiley:

Assuming the Tracked Entity here is child (Person). If you want the age to be linked directly to the TEI then you’d be using attributes but if you wanted to use the age in program stages/events then you’d be using a data element. In this example I will use attributes.

Create tracked entity attribute:

Start by creating an attribute: age in Months of Value type “Positive Integer” (can be TEXT) and the aggregation type None [I think it’s also possible to use count but 100% not sum :slight_smile:]

Create Program rule variable:

AgeMonths: Source type: tracked entity attribute, Date of birth (assuming you have already created DoB attribute)

Create Program rule:




:sparkles::sparkles::sparkles::sparkles:

:sparkles::sparkles::sparkles::sparkles:

One thing to make note of is that I used the Positive Integer type but you’d use TEXT instead and add the word ‘months’ to the program rule action to make it appear “2 months”.

It’s also possible to create another program rule that hides the field when the number/TEXT becomes 13 months, and then show another field for years. If you want.

Thank you for the question and thanks @asacur for the support! :grin:

2 Likes