Jump to content

  •  

Photo

Nested IF Logic

if function nested

  • Please log in to reply
9 replies to this topic

#1 MariaAux  apprentice

MariaAux
  • Members
  • 142 posts
  • FM Application:11 Advance
  • Platform:Windows 7
  • Skill Level:Novice
  • Time Online: 5d 20h 24m 3s

Posted 25 November 2011 - 02:46 AM

I'm Web publishing a Database of children's games. There are 4 fields;
Preparation (sometimes empty)
How_to_Play (Always filled)
Variations (sometimes empty)
Notes (sometimes empty)

I am trying to create a nested IF function that only displays the field if it has some text in it. Just displaying one big blob of text listing field after field is obviously easy, but I want to add a header above each field if the field I included. I am getting stuck because the 1st, 3rd and 4th field are all variables. This is as far as I've got;

If (Preparation=0;"";"PREPARATION"&¶&How_to_Play)

Up until here is fine, but now adding the IF function if Variations or Notes are also empty by including/excluding them or their headers is getting me a little stuck. Any help would be HUGELY appreciated.

Thanks so much in advance,
  • 0

#2 bcooney  consultant

bcooney
  • Moderators
  • 5,760 posts
  • LocationLong Island, NY
  • FM Application:13 Advance
  • FMGo:iPad
  • Platform:Cross Platform
  • Skill Level:Expert
  • Certification:9, 10, 11, 12
  • Membership:TechNet
  • Time Online: 23d 9h 43m 4s

Posted 25 November 2011 - 05:44 AM

If (not isempty ( Preparation); "Preparation¶" & Preparation & ¶¶; "") & If (not isempty (How_to_Play); "How to Play¶" & How_to_Play; "") &

etc.
  • 0

#3 andries  geek

andries
  • Members
  • 164 posts
  • FM Application:11 Advance
  • Platform:Mac OS X Leopard
  • Skill Level:Intermediate
  • Certification:9, 10, 11, 12
  • Membership:TechNet, FileMaker Business Alliance, FIleMaker Platinum Member
  • Time Online: 8d 14h 30m 52s

Posted 25 November 2011 - 05:52 AM

hi bcooney,

I guess you mean the "&" and not the "and" operator :)
otherwise it would evaluate to 0 or 1.
  • 0

#4 bcooney  consultant

bcooney
  • Moderators
  • 5,760 posts
  • LocationLong Island, NY
  • FM Application:13 Advance
  • FMGo:iPad
  • Platform:Cross Platform
  • Skill Level:Expert
  • Certification:9, 10, 11, 12
  • Membership:TechNet
  • Time Online: 23d 9h 43m 4s

Posted 25 November 2011 - 05:56 AM

My gosh, yes! Need another coffee after yesterday. I've corrected my original post.
  • 0

#5 andries  geek

andries
  • Members
  • 164 posts
  • FM Application:11 Advance
  • Platform:Mac OS X Leopard
  • Skill Level:Intermediate
  • Certification:9, 10, 11, 12
  • Membership:TechNet, FileMaker Business Alliance, FIleMaker Platinum Member
  • Time Online: 8d 14h 30m 52s

Posted 25 November 2011 - 06:32 AM

probably the right brain kicking in :)
  • 0

#6 LaRetta   Lifelong FM Student

LaRetta
  • Members
  • 9,839 posts
  • LocationOregon
  • FM Application:13 Advance
  • Platform:Mac OS X Mavericks
  • Time Online: 230d 22h 56m 34s

Posted 25 November 2011 - 07:46 AM

A few small points - 1) if you use two ¶ together, you must wrap them in quotes as "¶¶" so the above calc will throw a syntax error and 2) it is not necessary to list a default result when using If() or Case() (blank is assumed) so you can drop the "" results:

If ( not IsEmpty ( Preparation ) ; "Preparation¶" & Preparation & "¶¶" )
&
If ( not IsEmpty ( How_to_Play) ; "How To Play¶" & How_to_Play & "¶¶" )
&
If ( not IsEmpty ( Variations ) ; "Variations¶" & Variations & "¶¶" )
&
If ( not IsEmpty ( Notes ) ; "Notes¶" & Notes )
  • 0
Each assumption is an educated guess, a likely condition or event, presumed known and true in the absence of absolute certainty.

#7 MariaAux  apprentice

MariaAux
  • Members
  • 142 posts
  • FM Application:11 Advance
  • Platform:Windows 7
  • Skill Level:Novice
  • Time Online: 5d 20h 24m 3s

Posted 25 November 2011 - 11:35 AM

You guys are Geniuses! Laretta, your formula was fantastically simple to follow... and worked like a Charm. I don't know if I could really convey my absolute gratitude - You made my day! Have a wonderful day and thank you thank you again!
  • 0

#8 bcooney  consultant

bcooney
  • Moderators
  • 5,760 posts
  • LocationLong Island, NY
  • FM Application:13 Advance
  • FMGo:iPad
  • Platform:Cross Platform
  • Skill Level:Expert
  • Certification:9, 10, 11, 12
  • Membership:TechNet
  • Time Online: 23d 9h 43m 4s

Posted 25 November 2011 - 12:32 PM

LaRetta, you're so much more thorough than I am. I need to step it up.
  • 0

#9 Rick Whitelaw  Time Saver

Rick Whitelaw
  • Members
  • 724 posts
  • LocationToronto, Canada
  • FM Application:13 Advance
  • Platform:Mac OS X Lion
  • Skill Level:Intermediate
  • Time Online: 23d 6h 11m 39s

Posted 25 November 2011 - 05:00 PM

Hmmm . . . I've always learned from both of you!

RW
  • 0

#10 LaRetta   Lifelong FM Student

LaRetta
  • Members
  • 9,839 posts
  • LocationOregon
  • FM Application:13 Advance
  • Platform:Mac OS X Mavericks
  • Time Online: 230d 22h 56m 34s

Posted 27 November 2011 - 04:13 PM

And so do I, Rick. An error in one post does not a failure make. If so, I would be lower than the ground that dirt sits on. :yep:
  • 0
Each assumption is an educated guess, a likely condition or event, presumed known and true in the absence of absolute certainty.





FMForum Advertisers