Jump to content
• 0

# Search by age with date of birth

## Question

Hi,

I new to Caspio and still in the learning process in terms of understanding what it's capable of. I have a webform that allows the user to enter in their 'Date of Birth'. However, I also have a search webform that I want to let people search by the age of users. Is there a way to do this easily using Caspio? Or will there need to be some fancy Javascript work done? Thanks ahead of time.

-Henry

## Recommended Posts

• 0

Hi Henry,

Yes, a Java Script is needed to calculate the age and store in the table so you can use the age field in the search form.

Sample Java Scripts at http://www.caspio.com/support/jssolution.asp will give you an idea how to integrate them within Caspio.

Caspio professional service department could also write the code for you.

Best,

Bahar M.

##### Share on other sites

• 0

Hi @Yimister,

With the new standard feature of Caspio, you can calculate the age of the user by just entering only their date of birth and save it on your table without using JavaScript.

You just need to add another field on your table and label it as Age. On your Submission Form, set the form element of this field to Calculated Value and use this formula: Datediff(year, [@field:Date_of_Birth], GetUTCDate())

It will be saved on your table. By then, you can now use it as filtering criteria on your Search and Report DataPage.

For more information about Calculated Value and Function References you can go through these links:

Regards,

kristina

##### Share on other sites

• 0

Hey there!

I found a discussion similar to your inquiry.

On 7/22/2013 at 1:19 PM, clicknip said:

I have a table that includes the person's date of birth (DOB). I am able to create a virtual field in my Report DataPage that calculates the age from the DOB and display it. I also need to be able to search on age. How can I do searches such as:

1. Age is equal to x

2. Age is greater than x (minimum age is x)

3. Age is greater than minimum x and less than maximum y

Thank you for any help on this. The application has to do with booking models, where age is an important factor.

Hope this helps

##### Share on other sites

• 0

Hi,

Just found a similar article in the forum, check this out:

##### Share on other sites

• 0

Hi - Just an update on this, you may also use these formulas to know the exact age by day:

```DATEDIFF(hour,[@field:Birthday],SysDateTime())/8766
```
`FLOOR(DATEDIFF(DAY, [@field:Birthday], SysDateTime()) / 365.25)`

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
• #### Browse

×
• Create New...