April 8, 200520 yr Newbies Haven't figured how to record the date in a date field when someone clicked the checkbox "on:"
April 8, 200520 yr For the sake of argument lets assume you want the checkbox to set the Date field to the current date. Create a Value List named something like SetCurrentDate with the only value being "Y" (without the quotes). Next create a script called SetCurrentDate: If [MyTable::MyCheckBox ; "Y"] -Set Field[MyTable::MyCheckBox ; ""] -Set Field[MyTable::MyDate ; ""] Else - Set Field[MyTable::MyCheckBox ; "Y"] - Set Field[MyTable::MyDate ; Get(CurrentDate)] End If Then set the Field Format for you checkbox to "Check Box Set", Display Values from SetCurrentDate. Set your checkbox field to a button to perform script SetCurrentDate. *Edit: I re-read your post and maybe you want this value stored in a related table to track all changes to the checkbox?
April 8, 200520 yr Make your date field an auto-enter calc with the following calc: Case (not IsEmpty (your checkbox field) ; Get (Currentdate) ) This will always enter the date when someone checks the checkbox. When they uncheck it, it removes the date.
April 8, 200520 yr Right, never even thought about the auto-enter calc. A little more straight forward might be - If(IsEmpty(CheckBox);"";Get(CurrentDate))
April 9, 200520 yr If(IsEmpty(CheckBox);"";Get(CurrentDate)) You don't need the null result with vs. 7. We don't know what the checkbox 'on' represents. It might be a 1 toggle. I always have a 'Select' value list which simply contains a 1 so I can use the same value list for many on/off toggles on fields. If using a 1, all you need is: If(Checkbox; Get(CurrentDate)) On that Auto-Enter calculation - if you want the current date to appear when checked but disappear when unchecked, you must remember to unclick the checkbox below the Auto-Enter by Calculation that says, "Do Not Replace Existing Value." If you want the date last checked to remain, leave this clicked.
Create an account or sign in to comment