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.

Check Boxes with a Script

Featured Replies

I have a simple question:

If I have a checkbox lets call it "Incomplete". And I want to make a script that is an IF statement that says if checked then do something then uncheck it, if unchecked do something and check it. How would I do this?

If the checkbox is defined as a word "Incomplete" does a "1" or "0" check and uncheck it?

I know how to set fields but how do you unset feilds (Clear)?

Joseph

Instead of looking at it as "unsetting" a field, just look at it as setting a field. In your case, if you want the field to not have a value, set it to "". (that's double quotations with nothing in between)

  • Author

How do I cut and paste the whole script into this so I can show you what I have done?

Joseph

Print your scrip to a Text file, or PDF. On a Mac, we can print to preview and copy it from it, maybe you can do this on Windows also.

HTH

Lee

  • Author

Does this look right?

File_Incomplete

Freeze Window

If [ File_Login_Sheet::File_Folder = "File Incomplete" ]

Go to Related Record [ From table: “File_Login_SubSheet_Brokers”; Using layout:

“File_Login_SubSheet_Brokers” (File_Login_SubSheet_Brokers) ]

[ Show only related records; Match found set ]

Loop

Set Field [ File_Login_SubSheet_Brokers::File_Incomplete; "" ]

End Loop

Set Field [ File_Login_Sheet::File_Incomplete; "" ]

Go to Layout [ original layout ]

Else

Go to Related Record [ From table: “File_Login_SubSheet_Brokers”; Using layout:

“File_Login_SubSheet_Brokers” (File_Login_SubSheet_Brokers) ]

[ Show only related records; Match found set ]

Loop

Set Field [ File_Login_SubSheet_Brokers::File_Incomplete; "File Incomplete" ]

End Loop

Set Field [ File_Login_Sheet::File_Incomplete; "File Incomplete" ]

Go to Layout [ original layout ]

End If

Refresh Window

If the checkbox is defined as a word "Incomplete" does a "1" or "0" check and uncheck it?

I know how to set fields but how do you unset feilds (Clear)?

Joseph

If you're having just one box is it posible this way:

Set Field[theBox; 1 xor theBox]

...or in case you have an array of checkboxes:

http://www.briandunning.com/cf/39

...by setting the second paramter to checkbox's value you wish to alter, and the first paramter to the present state of the checkboxes.

--sd

Hey Joseph,

I created an example of what I believe is what you're trying to accomplish. Please find it attached to this post.

A couple of notes about your script:

Before looping through records, make sure that you go to and start at the correct record - in your case, the first one.

In looping through records, you must have a way of going to the next record within the loop.

There must be a condition for exiting the loop.

One minor thing I think you know about but just overlooked. You need to go back to the original layout before you can set its field...not the opposite, as you had it.

Take a look at the example and see if it works for you. Post any questions you have about it.

Hope some of this helps!

CheckboxChange.zip

Hi Joseph,

One more thing I forgot to mention that you might find helpful. In the Go To Related Record step, I changed the Result Option to "Match Current Record Only". If you don't do that then it will find all records related to the current found set in File_Login_Sheet. Then, as you loop through the records in your other table, ALL will have their fields set to the values based on the value of that single record in File_Login_Sheet. I assumed you didn't want that.

  • Author

Your Example showed me how to do loops... and I really thank you... I under stand them a lot better now.

In the script the "Else" part works great... it checks all of the checkbox for the record for me when run, but the;

"If" part of the script does not clear the checkboxes when run... Is there anything I did not do right?

Joseph

"If" part of the script does not clear the checkboxes when run...

Oops...I called out the wrong field to be set...try it now. ???

CheckboxChangeCorrected.zip

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.