Create a Button to Change a Date Field

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • Answered
I would like to have a Button that will update a Date Field with the Current Date. This would update all the Records with the Current Date. Is this Possible?
Photo of Gary Doucet

Gary Doucet

  • 270 Points 250 badge 2x thumb

Posted 1 year ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 53,570 Points 50k badge 2x thumb
When you say "all the records"  - Which Records?
Photo of Gary Doucet

Gary Doucet

  • 270 Points 250 badge 2x thumb
Ok, I have a table that I want to affect each record in that table meaning a Modify.  So I might have 20 records in the Table and I have a Generated Date.  I want to have a Button that will Loop through all 20 records and update the Generate Date with Today's Date.  

Possible?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 53,570 Points 50k badge 2x thumb
So if the table has 1000 records, you want to update all 1,000 records?  Or do you really mean that you have a report with 20 records out of 1,000 records and just want to update those ones.
Photo of Gary Doucet

Gary Doucet

  • 270 Points 250 badge 2x thumb
Yes, I am focused on updating the Table.  Maybe the most it will have is 100 records.  
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 53,570 Points 50k badge 2x thumb
How about Grid Edit.
Let's start low tech.

Go to Grid Edit.
Put a T for today in the date field.
Click on the column heading to highlight the column,
Right click to Fill down,
Save
Photo of Gary Doucet

Gary Doucet

  • 270 Points 250 badge 2x thumb
Yes, I can do that.  Maybe that's the easy way for now.   
Photo of Gary Doucet

Gary Doucet

  • 270 Points 250 badge 2x thumb
This works ok.  Thanks. 
Would be nice to have a Button to call an Action to handle this.  
Fewer Steps.  
Thanks for the Help.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 53,570 Points 50k badge 2x thumb
It is possible to make a button to do that.  Contact me via the information in my profile if you want assistance with that.

Basically we would use API_RunImport to import the records into themselves and update that 1 field and then land the user on the Table Home page. 
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 28,144 Points 20k badge 2x thumb
Attached is a screenshot of applying a console script to change the date of all records in a query. This can easily be implemented as a button and you are free to try it in the Mass Update application by changing the date in the script.

https://i.imgur.com/Yyw928H.jpg


Mass Update
https://haversineconsulting.quickbase.com/db/bm5hy8d2z

Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=604
(Edited)
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 28,144 Points 20k badge 2x thumb
There is a small inconsistency  in the image above regarding the date in the script and the displayed date in the report as I was repeatedly modifying the date in the console to test the script - it works and it works well.

FWIW, I type these scripts directly into the console and have a lot of other shortcut methods to speed up development and for drill. So I sometimes gloss over details when I post. Feel free to ask if you have questions.
(Edited)
Photo of Matthew Neil

Matthew Neil

  • 31,478 Points 20k badge 2x thumb
Another option is to use the "Search & Replace" option.  When you have a table report pulled up, you can apply any filtering you'd like. 

Then select the "more" menu option and "Search & Replace".

This would let you pick the field and mass update.

(small caveat is that you have to search for a particular value to replace, so grid edit might work too)
Just wanted to give you another idea. 
Photo of Matthew

Matthew

  • 296 Points 250 badge 2x thumb
Would this "link" be similarly used to create a button field on each record individually to change the field value of say a status text field/dropdown. Click button - sets field to Active/Inactive for instance. As a toggle....?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 53,570 Points 50k badge 2x thumb
Please post this as a new question.