Save the date! Join us on October 16 for our Product Ops launch event. Register here.
May 25, 2022 08:08 AM
I have a database with a number field that external automation will set to a value at certain times. I then require that value to be reduced by one every day until it reaches zero again.
I tried to set this up using Find Record and Update Record in automation but it doesn’t appear that it can do this with multiple records in one table at a time. :grimacing:
Is there a way to set this up? Possibly with some scripting?
May 25, 2022 09:54 AM
Hi there! Yes, Airtable automations can’t perform calculations at this point. So this needs to be handled with a script (within automations). Trigger would be at a scheduled time daily and then the script runs and deducts 1 from a given number field. Is this always one specific field or various fields? If it’s one specific field, it would work like this:
May 25, 2022 10:09 AM
If you are on the free plan and do not have access to Automation Scripting, you can add this formula to count the number down every day. Then an automation that triggers on the update of the formula, to copy the formula result and update the number record
Number-DATETIME_DIFF(TODAY(),DATETIME_FORMAT(CREATED_TIME(),'L'),'days')
May 25, 2022 11:16 AM
Thanks! I’ll check out these options. I’m on the paid plan btw.
For now I set it up in the Integromat scenario that does other stuff with the database and tbh it doesn’t use up too many extra operations so I may leave it like that for now. :blush:
May 25, 2022 11:18 AM
It is for a number of fields.
May 25, 2022 07:28 PM
you can still solve by automations, creating formula field with your field-1 and put it’s value where you need. or if your table should not contain extra fields, create mini-table for that