Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

Is it possible to create a single field that accepts user input or autoenters calculation?


This topic is 6779 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

I am working on a database where I need to do sorts by age. For some of the records, I have the child's date of birth and for some I only have their current age. (Obviously, age based on date of birth is more useful since it is dynamic.)

Right now I have three fields:

1. Age Field (User can enter in the age)

2. Date of Birth

3. Age Calculation (Auto enters age based on birthday. If Birthday field is empty then it autoenters age based on "Age Field." If both age field and date of birth contain a value, the date of birth takes priority.

[i've attached a simple example]

In sum, I am wondering if its possible to have a single age field that will allow the user to input a value. If the user leaves the age field blank, but enters the date of birth, then the age field performs a calculation to determine the correct age. In other words can a field exist as either a calculation or a user-definable value?

Obviously, the easiest solution would be to have the date of birth for every record; unfortunately, that isn't practical.

I realize I could run a script to check whether the date of birth field is filled and then calculate and insert the age into a single age field. However, I'd rather find a solution that doesn't use scripts and operates solely on the field definition level.

Thanks for the help.

age_and_birthday.fp7.zip

Edited by Guest
Posted

Please tell me if this is getting your boots too filled:

http://edoshin.skeletonkey.com/2006/06/linked_fields.html#more

--sd

Posted

I think we're getting a bit ahead of ourselves soren ... something more simple will do.

We use an auto-enter calculation in one of two ways:

1) We specify it as auto enter and untick the "do not evaluate if field contains something" (paraphrase) option under auto enter.

We specify the calculation to be:

If(not IsValid(DOB) or IsEmpty(DOB) ; AgeField ; YourAgeCalcThatUsesDOBAndPerhapsGetCurrentDateGoesHere)

- note that the IsEmpty() function maybe redundant here

2) We specify it as auto enter and don't untick the "do not evaluate if field contains something" option under auto enter.

Then we simply enter YourAgeCalcThatUsesDOBAndPerhapsGetCurrentDateGoesHere

Posted

I am afraid there's a problem here that cannot be solved by Søren's and Genx's suggestions: the calculation of age from BirthDate (when BirthDate is known) needs to be UNSTORED. This, I think, would rule out any auto-entered calculation, since such calculation, once entered, will be 'frozen in time'.

This topic is 6779 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.