
Quote from CSSystems on September 19, 2022, 1:07 amI have an app that using Checkboxes whose results are connected to boolean database fields.
In order to reset all values of the fields to false, I have used a SQL update command to change the values to False.
However, the checkbox remains in Checked status until I restart the app.
What is the best way to change the database fields to false and the checkbox status to unchecked at the same time?
Perhaps I should be using a While or Loop routine ??
I have an app that using Checkboxes whose results are connected to boolean database fields.
In order to reset all values of the fields to false, I have used a SQL update command to change the values to False.
However, the checkbox remains in Checked status until I restart the app.
What is the best way to change the database fields to false and the checkbox status to unchecked at the same time?
Perhaps I should be using a While or Loop routine ??
Quote from Gaev on September 19, 2022, 4:27 pm@cssystems
I have an app that using Checkboxes whose results are connected to boolean database fields.
It is not clear what you mean by "connected to boolean fields" ... but if you have specified Special Database Variables (e.g. [myDB.myTable.myField1]) for the "variable associated with the status of the Checkbox", note that it will not work; only regular variables (e.g. myCheckBox1]) will trigger a visual change.
In order to reset all values of the fields to false, I have used a SQL update command to change the values to False.
However, the checkbox remains in Checked status until I restart the app.
What is the best way to change the database fields to false and the checkbox status to unchecked at the same time?Assuming that you have specified Special Database Variables as the variables associated with the Checkboxes, set them to regular (non-database) variables ... then, follow your SQL command with a bunch of commands like ...
SetVar "[CheckBoxX]" ""... where [CheckBoxX] is the variable associated with the checkbox in question.
I have an app that using Checkboxes whose results are connected to boolean database fields.
It is not clear what you mean by "connected to boolean fields" ... but if you have specified Special Database Variables (e.g. [myDB.myTable.myField1]) for the "variable associated with the status of the Checkbox", note that it will not work; only regular variables (e.g. myCheckBox1]) will trigger a visual change.
In order to reset all values of the fields to false, I have used a SQL update command to change the values to False.
However, the checkbox remains in Checked status until I restart the app.
What is the best way to change the database fields to false and the checkbox status to unchecked at the same time?
Assuming that you have specified Special Database Variables as the variables associated with the Checkboxes, set them to regular (non-database) variables ... then, follow your SQL command with a bunch of commands like ...
SetVar "[CheckBoxX]" ""
... where [CheckBoxX] is the variable associated with the checkbox in question.

Quote from CSSystems on September 19, 2022, 5:23 pmThank Gaev,
I wasn't sure how the SetVar "[CheckBox]" "" would work with the SQL. Once the SQL updates all the fields then would the checkbox no longer be checked scrolling through the records? Below is what I attempted. So I just need to use SetVar "[AttendingCB]" "" following each SQL?
.MessageBox "Reset Files" "Clear Invited Fields Attending, Responded, Date" "Yes|No" "[ResetAns]"
.If "[ResetAns]" "=" "1"
. dbpExecSQL "YouRdb" "UPDATE Invited SET Attending = False" ""
. dbpExecSQL "YouRdb" "UPDATE Invited SET Responded = False" ""
. dbpExecSQL "YouRdb" "UPDATE Invited SET AttendingDate = Null" ""
. AlertBox "Reset Done" "Reset is Complete."
.Else
. AlertBox "Reset Cancel" "Reset is Cancelled."
.EndIf
Thank Gaev,
I wasn't sure how the SetVar "[CheckBox]" "" would work with the SQL. Once the SQL updates all the fields then would the checkbox no longer be checked scrolling through the records? Below is what I attempted. So I just need to use SetVar "[AttendingCB]" "" following each SQL?
.MessageBox "Reset Files" "Clear Invited Fields Attending, Responded, Date" "Yes|No" "[ResetAns]"
.If "[ResetAns]" "=" "1"
. dbpExecSQL "YouRdb" "UPDATE Invited SET Attending = False" ""
. dbpExecSQL "YouRdb" "UPDATE Invited SET Responded = False" ""
. dbpExecSQL "YouRdb" "UPDATE Invited SET AttendingDate = Null" ""
. AlertBox "Reset Done" "Reset is Complete."
.Else
. AlertBox "Reset Cancel" "Reset is Cancelled."
.EndIf
Quote from Gaev on September 19, 2022, 8:52 pm@cssystems
I wasn't sure how the SetVar "[CheckBox]" "" would work with the SQL.
VisualNEOWin [variables] have nothing to do with the "special field variables" that neoDBPro uses to reference the values of the fields in the CURRENT record/row.
Once the SQL updates all the fields then would the checkbox no longer be checked scrolling through the records? Below is what I attempted.
So I just need to use SetVar "[AttendingCB]" "" following each SQL?The key point is that you specify a regular [variable] as the variable associated with a checkbox ... I am not sure what [AttendingCB] is associated with ... if you have 3 fields, would there not be 3 checkboxes ? ... each having a different associated variable.
So, it becomes your responsibility to make sure that any change ...
a) made by you to the Database records is reflected in the variable associated with the corresponding checkbox (via the SetVar command)
b) made by the user to the visual representation of the Checkbox (which in turn will update the variable associated with the checkbox) is reflected by you in a change to the associated database field in the current record
c) due to the user navigating from record to record is also reflected in the variable associated with the corresponding checkbox (via SetVar command) ... take a look at the "subroutine" parameter of the dbpOpenTable command to have your Application know every time this happens.
I wasn't sure how the SetVar "[CheckBox]" "" would work with the SQL.
VisualNEOWin [variables] have nothing to do with the "special field variables" that neoDBPro uses to reference the values of the fields in the CURRENT record/row.
Once the SQL updates all the fields then would the checkbox no longer be checked scrolling through the records? Below is what I attempted.
So I just need to use SetVar "[AttendingCB]" "" following each SQL?
The key point is that you specify a regular [variable] as the variable associated with a checkbox ... I am not sure what [AttendingCB] is associated with ... if you have 3 fields, would there not be 3 checkboxes ? ... each having a different associated variable.
So, it becomes your responsibility to make sure that any change ...
a) made by you to the Database records is reflected in the variable associated with the corresponding checkbox (via the SetVar command)
b) made by the user to the visual representation of the Checkbox (which in turn will update the variable associated with the checkbox) is reflected by you in a change to the associated database field in the current record
c) due to the user navigating from record to record is also reflected in the variable associated with the corresponding checkbox (via SetVar command) ... take a look at the "subroutine" parameter of the dbpOpenTable command to have your Application know every time this happens.

Quote from fkapnist on September 19, 2022, 10:56 pmQuote from CSSystems on September 19, 2022, 5:23 pmThank Gaev,
I wasn't sure how the SetVar "[CheckBox]" "" would work with the SQL. Once the SQL updates all the fields then would the checkbox no longer be checked scrolling through the records? Below is what I attempted. So I just need to use SetVar "[AttendingCB]" "" following each SQL?
.MessageBox "Reset Files" "Clear Invited Fields Attending, Responded, Date" "Yes|No" "[ResetAns]"
.If "[ResetAns]" "=" "1"
. dbpExecSQL "YouRdb" "UPDATE Invited SET Attending = False" ""
. dbpExecSQL "YouRdb" "UPDATE Invited SET Responded = False" ""
. dbpExecSQL "YouRdb" "UPDATE Invited SET AttendingDate = Null" ""
. AlertBox "Reset Done" "Reset is Complete."
.Else
. AlertBox "Reset Cancel" "Reset is Cancelled."
.EndIfIf I have 2 SQL updates (Attending, Responded) I'd give their checkboxes similar variable names like [CheckBoxAttending] and [CheckBoxResponded] which can be set to "checked" or, "" for unchecked.
. dbpExecSQL "YouRdb" "UPDATE Invited SET Attending = False" "" SetVar "[CheckBoxAttending]" "" . dbpExecSQL "YouRdb" "UPDATE Invited SET Responded = False" "" SetVar "[CheckBoxResponded]" "" . dbpExecSQL "YouRdb" "UPDATE Invited SET AttendingDate = Null" "" . AlertBox "Reset Done" "Reset is Complete."Also note that the end user can change the state of a checkbox just by clicking it. So you might want to disable the checkbox to avoid any mix ups:
SetVar "[CheckBoxResponded]" "Checked" DisableObject "[CheckBoxResponded]"
Quote from CSSystems on September 19, 2022, 5:23 pmThank Gaev,
I wasn't sure how the SetVar "[CheckBox]" "" would work with the SQL. Once the SQL updates all the fields then would the checkbox no longer be checked scrolling through the records? Below is what I attempted. So I just need to use SetVar "[AttendingCB]" "" following each SQL?
.MessageBox "Reset Files" "Clear Invited Fields Attending, Responded, Date" "Yes|No" "[ResetAns]"
.If "[ResetAns]" "=" "1"
. dbpExecSQL "YouRdb" "UPDATE Invited SET Attending = False" ""
. dbpExecSQL "YouRdb" "UPDATE Invited SET Responded = False" ""
. dbpExecSQL "YouRdb" "UPDATE Invited SET AttendingDate = Null" ""
. AlertBox "Reset Done" "Reset is Complete."
.Else
. AlertBox "Reset Cancel" "Reset is Cancelled."
.EndIf
If I have 2 SQL updates (Attending, Responded) I'd give their checkboxes similar variable names like [CheckBoxAttending] and [CheckBoxResponded] which can be set to "checked" or, "" for unchecked.
. dbpExecSQL "YouRdb" "UPDATE Invited SET Attending = False" "" SetVar "[CheckBoxAttending]" "" . dbpExecSQL "YouRdb" "UPDATE Invited SET Responded = False" "" SetVar "[CheckBoxResponded]" "" . dbpExecSQL "YouRdb" "UPDATE Invited SET AttendingDate = Null" "" . AlertBox "Reset Done" "Reset is Complete."
Also note that the end user can change the state of a checkbox just by clicking it. So you might want to disable the checkbox to avoid any mix ups:
SetVar "[CheckBoxResponded]" "Checked" DisableObject "[CheckBoxResponded]"

Quote from CSSystems on September 20, 2022, 1:48 amThanks for you replies.
I can now revisit my SQL code.
I was looking at loop to accomplish the same thing.
That for the review and clarification.
Thanks for you replies.
I can now revisit my SQL code.
I was looking at loop to accomplish the same thing.
That for the review and clarification.