Filtering option available for calculating days

Hi everyone.

Actually i have an person aggregate .it contains name ,age and date of birth .so is there any filter option available to get the age from the user date of birth.

Screenshot (432).png

@Arjun S 


This component might help you to get the age from date of birth.

Hello Arjun,

You can use forge component Vrushali mentioned or you can calculate it by yourself.

You can use built in function DiffDays(BirthDate,CurrDate()) which will return difference in days and you can convert it to years or years and months

Also you can subtract birthdate year from current year then you can use AddYear(currDate(),- Result of subtraction) then check if it is less than birthdate then age will be subtraction result -1 and this in case you will use age as years only without days or months

can we execute the things in the filter option in the aggregate or need to create an client or server action sir

Can you please explain more what you are trying to do?

Do you already saved age as integer into table or you want to calculate it?

If you need to do a filer only on aggregate you can implement something like that into filter

Person.Age = Year(CurrDate()) - Year(Birthdate) 

Please note that Birthdate here is a value entered by user or used to filter not the value into table

i need do that thing in the aggregate function .is it possible in that sir


Hi You Can calculate the age by creating a service action which will have 2 input parameter and one out put parameter :
Input Parameters:-
1.StartDate (which will the birth date) 2. EndDate( Current date)  
Output Parameter:-
1.Current Age
In the action you can build logic where we will compare if birthday is in this year and has occured already then : Current age = (Year(EndDate)-Year(StartDate))
then if not then the Current age = (Year(EndDate)-Year(StartDate)) - 1
And then the output can be updated in the entity.

or if you you want you can use the following forge component


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.