Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Complex IF Statements

Featured Replies

Right, im sure this isnt that complex (but i can be a tad daft sometimes), i have 5 fields, single checkboxes with a value list set to each with the only option being "yes" within the checkbox (i know you can have one field with 5 options ive just being having trouble with the if statements).

If certain checkboxes are selected i need a calculated result to be entered into another field. I.e. if field one is checked, add in text specific to that field. If field two is set to yes add more text to the previous text entered as a result of checkbox one being set to yes and so on.

So i guess my final question is how would i setup a script to check which of the five checkboxes are checked (lets call the fields a - e) and insert text specific to whether or not those fields are set to "yes". I assume this has something to do with loops but i am yet to understand it.

Help would be great, cheers in advance

genx

Why dont want have calculation field as:

Text=Case(Field1="Yes","Field1_Checked","")&

Case(Field2="Yes"," Field2_Checked","")&

Case(Field3="Yes"," Field3_Checked","")&

Case(Field4="Yes"," Field4_Checked","")&

Case(Field5="Yes"," Field5_Checked","")

  • Author

well, i didnt know what the case function was for,

cheers mate

Other options exists though, if you instead make the valuelist

{1,2,4,8,16} instead and draw the single field in a way that hides these numbers, fiddling with custom linespacing makes sense as well.

This makes this posible:

Choose ( Evaluate ( Substitute ( CheckboxField ; "¶" ; " + " ) ) ; result0 {; result1 ; result2...} )

I would expect it to be slightly faster than Case'ing, and if searches are likely does it make sence to have just one indexed instead of five.

--sd

Aren't you forgetting this is a checkbox field? A single field, with a list of 5 values, has 32 (2^5) possible states. Are you going to write out all 32 possible results for the Choose() function?

Aren't you forgetting this is a checkbox field?

No I'm not ...it just occured to me that if you structure this way are you forced to think of all posibilities in a organized manner.

Not that it's needed in this case, but...

--sd

I have nothing against thinking. I was objecting to excessive typing. Here's how I would do this.

(Seems upload is broken now - I'll try later)

Yes, hiccups occure ...eventhough I was among the jaw-droppers at devcon, when the topic was PHP ...might this be a flaw in the machinery serving or...:

--sd

  • Author

cheers guys,

comment your way ended up workin best. For future reference where do you get the § symbol and what abouts does it mean?

Cheers

The actual character used is not important. I happen to have a non-standard keyboard with easy access to this character, but you can use any character that is not going to be used in the text. It has no meaning - it merely tags the last ¶, so that you don't end up with a trailing " and ".

  • Author

righto, thanks

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.