Checkbox help - Forum

Forum Navigation
You need to log in to create posts and topics.

Checkbox help

Having trouble with Checkbox and Database. I have an application which records whether someone is attending our event or not. I am using a Checkbox for Attending. The Database field is Attending Boolean.

Should clicking on the Checkbox save to the Boolean field in the database 'True' or 'False'

Or should the database field be string field to kept the Status of  the Checkbox "Checked" or not.

How do I link the Checkbox to the Database field to indicate the Attending or not so it shows the correct status?

Help would be appreciated.

@cssystems

You will see on this help file page ... https://winhelp.visualneo.com/CheckBoxTool.html ... that the state of the Checkbox is stored in a variable of the same name (unless you chose to change it) ... this variable will contain the text/string of "Checked" when the user has checked the box.

Should clicking on the Checkbox save to the Boolean field in the database 'True' or 'False'
Or should the database field be string field to kept the Status of the Checkbox "Checked" or not.

While you can use a Boolean (True/False) field to store the information on the database, it is probably better to assign a Char field (length of 7 will hold the word Checked) ... and then store the content of the variable associated with the Checkbox object AS IS ... same when reading the record (later on) and populating the Checkbox (in case you need to edit/change this record).

@cssystems

If you're using an Access DB, an MDB file, in Access the CheckBox boolean field will be "-1" if checked and "0" if unchecked. When read by DBPro the field variable will return as "Checked" or "False". I know it seems a bit confusing. I don't know how other DB types handle the boolean but it's probably safe to just check if the variable is "Checked".

If "[party.guestlist.attend]" "=" "Checked"
SetVar "[Attending]" "I'll be there with bells on."
Else
SetVar "[Attending]" "Sorry. I'm washing my hair."
EndIf

You might just run your action code in debug mode and see what your variables return and write your code accordingly.