48
Views
4
Comments
Solved
Calculate age based on selected date
Application Type
Reactive

Hi OS community! Can you help on how to achieve this functionality where if the user select their birthdate in the datepicker it must calculate their accurate age and then automatically fillup the age input field and after clicking the submit button it must store both age and birthdate in the database.


BulkUserProcessing.oml
Solution

Hi @Digital Hunter,

I have Assigned 

"If( Month(GetAppoinmentById.List.Current.Appoinment.Birthdate)

    Year(CurrDate())-Year(GetAppoinmentById.List.Current.Appoinment.Birthdate) - 1, 

        If( Month(GetAppoinmentById.List.Current.Appoinment.Birthdate)=Month(CurrDate()) and Day(CurrDate())

            Year(CurrDate())-Year(GetAppoinmentById.List.Current.Appoinment.Birthdate) - 1, 

                Year(CurrDate())-Year(GetAppoinmentById.List.Current.Appoinment.Birthdate)))"

this to the "GetAppoinmentById.List.Current.Appoinment.Age" on the OnChange Event of datepicker.

And It seems to be working fine now.

I Hope this helps. I am also attaching the Solution's zipped OML for your reference, Since the OML file was large and couldn't be uploaded here.

Also I have Dragged the DatePicker Field Above the Age field, since It's getting auto-populated depending on the datepicker, So its better to put it after.


Thank You!!


BulkUserProcessingSolution.zip

Hello Digital Hunter, 

Check the following post: 

Best regards, 

Ana

Hello,

Here  I have implemented the age logic, please find it in Test screen under the OML.

Hope this helps,

Komal

age.oml

Hey @Digital Hunter ,

Your code is perfect just create an OnChange event of Birthdate.In my case it "Input_BirthDateOnChange".


It will work.Try this out and let me know.

Thanks & Regards,

Sudip Pal

Solution

Hi @Digital Hunter,

I have Assigned 

"If( Month(GetAppoinmentById.List.Current.Appoinment.Birthdate)

    Year(CurrDate())-Year(GetAppoinmentById.List.Current.Appoinment.Birthdate) - 1, 

        If( Month(GetAppoinmentById.List.Current.Appoinment.Birthdate)=Month(CurrDate()) and Day(CurrDate())

            Year(CurrDate())-Year(GetAppoinmentById.List.Current.Appoinment.Birthdate) - 1, 

                Year(CurrDate())-Year(GetAppoinmentById.List.Current.Appoinment.Birthdate)))"

this to the "GetAppoinmentById.List.Current.Appoinment.Age" on the OnChange Event of datepicker.

And It seems to be working fine now.

I Hope this helps. I am also attaching the Solution's zipped OML for your reference, Since the OML file was large and couldn't be uploaded here.

Also I have Dragged the DatePicker Field Above the Age field, since It's getting auto-populated depending on the datepicker, So its better to put it after.


Thank You!!


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