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 7010 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I've been successful in creating a calcuation field with a basic "If Statement." If this, else that. However, I am now trying to create a calculation field that has several criteria.

If this

If this

If this

Else this

However, if I code:

If...

Else If...

Else If...

Else...

As I can in ScriptMaker, I get an error message that the program doesn't recognize the "Else If."

So I guess I'm asking if you can have repeated "If" statements in a field definition and, if so, how?

TIA

Posted

In a calculation you need to nest the ifs (or use a Case statement). For example

If(test1;result1;If(test2;Result2;If(test3;Result3;Default)))

or as a Case statement

Case(

test1;Result1;

test2; Result2;

test3;Result3;

Default)

Posted

If(test1;result1;If(test2;Result2;If(test3;Re sult3;Default)))

Ummm, that is what AND is for

If this AND this AND this ...

I dislike pseudo examples because they never make sense. If you give us your specific need, we can help you with real logic. Otherwise, we're all just guessing here ... :wink2:

LaRetta

Posted

If(test1;result1;If(test2;Result2;If(test3;Re sult3;Default)))

Ummm, that is what AND is for

If this AND this AND this ...

I don't think this is a simple AND. In words:

if test1 is true then result1.

If test1 is false and test2 is true then result2

If text1 is false and test2 is false and test3 is true then result3

If test1 is false and test2 is false and test3 is false then default

Posted (edited)

Thanks everyone!

All those replies look great and I'm sure I can get my field to work correctly now...I'll let you know.

In the meantime, if both "If" and "Case" statements will work, why choose one over the other in a formula? I've never been able to understand that.

TIA

Edited by Guest
Posted

choose one over the other in a formula?

Iffing is somewhat tighter with only 2 results, while Case( can be almost limitless, in the stacking of conditions. The readability is the main factor when choosing. It's a matter of developers habits I do hardly ever use iffing!!!

--sd

Posted

OK, wanted to let everyone know I used the "Case" statement and it worked beautifully!

Although I suspect that the "If" statement would have worked equally well.

Sometimes the manual and online help just don't make things clear enough. I'm sure I will have more questions as I work through this solution, but, so far, so good. Thanks so much for your help!

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