October 9, 200025 yr Newbies I have a field define as a calculation type. I want to create a nested if. Ex. If(mother="deceased")and If(father="deceased") field="the late " New to filemaker pro.. Not sure of the syntax. Thanks for your help...
October 9, 200025 yr Assuming you want the words "the late" to appear if both parents are deceased, otherwise the field is blank: Field= If(mother="deceased", If(father="deceased", "the late", ""), "") The syntax is: If(condition, then, else). In this case, there's a nested "If" statement in the "then" part of the first "If" statement. HTH, Dan
October 9, 200025 yr quote: Originally posted by oshnic: I have a field define as a calculation type. I want to create a nested if. Ex. If(mother="deceased")and If(father="deceased") field="the late " New to filemaker pro.. Not sure of the syntax. Thanks for your help... For this particular instance, you don't need to nest the Ifs. You could do the following: If( mother="deceased" and father="deceased", field="the late ", "" ) If there does come a time when a nested if would be what you want because you can't get what you need with the above kind of calc, you might want to take a look at the Case statement, which has syntax like this: Case( test1, result1, test2, result2, default result) The above is functionally equivelant to If( test1, result1, If( test 2, result 2, default result )) But you can see that if you have ten possibilities, a nested If can get pretty convoluted, which is why in general, the Case statement is prefered. Chuck
October 10, 200025 yr I second that one, Chuck. I find myself using more and more Case statements almost to the exclusion of using the IF() statement. When written: Case( test1, result1, test2, result2, test3, result3, default) it is much easier to create, read, and debug. The added carriage returns and blanks cause no problems. -bd
Create an account or sign in to comment