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

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

Recommended Posts

Posted

Is there a way to make a field conditionally required? For example, can you make field A required to be "not empty" only if field B has a value, but not required to be not empty if field B does not have a value?

Posted

In the validation options, you can validate by calculation. It uses a Boolean expression (True/False).

Posted

Forgive my ignorance, but how does this actually work? I have a group of address fields, (street, city, state, etc.) that I want to be required if the value of the field "Different contact Info?" equals "Yes" If the value of that field is "No" (or any other value), I want the address fields to not be required. I tried checking the "validate by calculation" and then creating a calculation where "Different Contact Info? = "Yes" but that didn't make the field required to have a value even if "Different Contact Info" = "Yes"

Posted

Try this calc into validation option of field address:

Case(

Different contact Info? = "YES" and IsEmpty ( Self ) ; 0;

1

)

Remember to uncheck the box: Validate only if field has been modified

Posted

Try this (using "address" field for example):

Case( Different Contact Info = "Yes" ; not IsEmpty( address ) ; 1 )

Posted

I tried that, but still no luck. The only thing that changes whether the field is required or not is if the "Not Empty" checkbox is toggled, regardless of whether "Validated by Calculation" is checked or not.

Posted

Try again.

Different contact Info? may have 3 status:

1) Empty

2) some chars

3) YES

but only when in status 3) we want Address NOT empty

So the expression:

Different contact Info? = "YES" and IsEmpty ( Self )

must produce an error.

Any other must be accepted.

Posted

There's a saying, "trying the same thing over and over and expecting different results amounts to insanity." So I would have to change something in order to make it worth trying. Any suggestions? It would help if I were a bit clearer on what the "Validate by calculation" really means. What I want it to mean is, "this field cannot be empty if this other field has a value of 'yes'." Is there a programmatic way of achieving this end?

Posted

"this field cannot be empty if this other field has a value of 'yes'."

[color:red]IF

IsEmpty ( Self ) and Different contact Info? = "YES"

[color:red]ERROR

"Is there a programmatic way of achieving this end?"

Yes.

BTW: my calc can even be simpler:

not ( IsEmpty ( Self ) and Different contact Info? = "YES" )

that is the same as saying:

I don't want [color:red]( not ) this field empty [color:red]( IsEmpty ( Self ) ) when [color:red]( and ) Different contact Info? contains [color:red]( = ) "Yes"

Posted

Obviously trying the same thing isn't going to work...

You need to change something...it works fine for me. At the bottom of the calculation screen it tells you what represents True/False. "Non-zero results are true, Zero and empty results are false". If the result of the calculation is true, it accepts the value. Otherwise, it rejects the value and throws an error.

If your calculation isn't resulting in the correct value, it is something in the calc.

This topic is 5970 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.