Hey @MichelleS ! At first I thought this would be super simple, but ended up being slightly more complicated than I thought, but cracked the code! I recorded a quick Loom video to take you through step by step how I set it up.
Remember when setting this up for yourself to update the Table names / fields / variables to match your data exactly to make it work.
Table Setup:
Due Week Formula:
DATEADD(
{Date of Event}, {Weeks Until Due}, 'weeks'
)
Due Date Formula:
DATEADD({Due Week}, {Extra Days}, 'days')
Day Of Week Formula:
DATETIME_FORMAT( {Due Date}, 'dddd' )
"Is It Thursday?" Formula:
IF(
OR({Extra Days} = -1, NOT({Weeks Until Due})),
"n/a",
IF(
{Day Of Week} != "Thursday",
"No", "Yes"
))
Automation Setup:
Automation Input Variables:
Automation Script:
var assignementTable = base.getTable("Assignments");
var inputConfig = input.config();
var recordID = inputConfig.recordID;
var extraDays = inputConfig.extraDays;
var addExtraDay = extraDays + 1;
// Temp Creating Fake Data (To Allow Automation To Retrigger)
var updates1 = [{
"id": recordID,
fields: {
"Extra Days": -1
}
}]
await assignementTable.updateRecordsAsync(updates1);
// Updating Due Date With New Date
var updates2 = [{
"id": recordID,
fields: {
"Extra Days": addExtraDay
}
}]
console.log(updates2)
await assignementTable.updateRecordsAsync(updates2);
Let me know if this worked for you!!