Joseph31 Posted October 25, 2005 Posted October 25, 2005 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
Kent Searight Posted October 25, 2005 Posted October 25, 2005 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)
Joseph31 Posted October 25, 2005 Author Posted October 25, 2005 How do I cut and paste the whole script into this so I can show you what I have done? Joseph
Lee Smith Posted October 25, 2005 Posted October 25, 2005 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
Joseph31 Posted October 25, 2005 Author Posted October 25, 2005 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
Søren Dyhr Posted October 25, 2005 Posted October 25, 2005 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
Kent Searight Posted October 26, 2005 Posted October 26, 2005 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
Kent Searight Posted October 26, 2005 Posted October 26, 2005 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.
Joseph31 Posted October 26, 2005 Author Posted October 26, 2005 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
Kent Searight Posted October 26, 2005 Posted October 26, 2005 "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
Recommended Posts
This topic is 7035 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now