November 17, 200520 yr 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
November 17, 200520 yr 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)
November 18, 200520 yr 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 ... LaRetta
November 18, 200520 yr 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
November 18, 200520 yr Author 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 November 18, 200520 yr by Guest
November 18, 200520 yr 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
November 18, 200520 yr Author 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!
Create an account or sign in to comment