Copy link to clipboard
Copied
Hi!
I have a field for "Week Ending Date" and then I have individual fields for each date of that week.
I'd like those individual date fields to auto-populate the correct date when the "Week Ending Date" field is filled in.
Is that possible?
Thank you so much!
Copy link to clipboard
Copied
Yes, this is possible using a script.
Here's the basic code to do it (to be used as the calculation script for the field that needs to show the day before that date, for example):
var s = this.getField("WeekEndingDate").valueAsString;
if (s=="") event.value = "";
else {
var d = util.scand("mm/dd/yyyy", s);
d.setDate(d.getDate()-1);
event.value = util.printd("mm/dd/yyyy", d);
}
Copy link to clipboard
Copied
Yes, this is possible using a script.
Here's the basic code to do it (to be used as the calculation script for the field that needs to show the day before that date, for example):
var s = this.getField("WeekEndingDate").valueAsString;
if (s=="") event.value = "";
else {
var d = util.scand("mm/dd/yyyy", s);
d.setDate(d.getDate()-1);
event.value = util.printd("mm/dd/yyyy", d);
}
Copy link to clipboard
Copied
Thank you!! You are amazing!! 🙂
By reading and following through your script I even managed to set it so that it displays only the date "dd" in the individual fields.
Thank you again so much!!
Have a great day!
Copy link to clipboard
Copied
Great, and you're very welcome!
Copy link to clipboard
Copied
Wanted to say thank you for this. I needed something similar and adjusted accordingly for my usage. Works great. Couldnt have done it without this getting me 90% there.