Is it possible (while auto-binding with Air/Date TimePicker) to update a subsequent date based on a user’s changing a previous date on the same page?
Currently:
If the user changes task A’s date from 8/29 to 9/5, the number of days between task A and task B reduces, but the date of task B does not change:
Desired:
When the user changes task A’s date from 8/29 to 9/5, I want to maintain the number of days between task A and task B, thus “bumping” the date of task B.
Yeah, but I’m trying to do it with auto-binding, meaning there’s no “save” button to click and no workflow to follow. The problem I’m running into is that if, for example, you choose an earlier date that is later than a subsequent date, you can have negative future dates.
Wow, very interesting, thanks! I was able to set it so that if a date is changed by the user it changes the next element by a (hard coded) number of days (7). Now I just have to figure out how to make it dynamic, so that when date A is changed, date B changes by the same number of days it was previously ahead of date A by. But this is a great advance from where I was at – much appreciated!
Ah wow, okay, I see where you’re going with that. I’ve only really used custom states so far to, like, call up hidden groups when the user clicks on a button, but I think I can try to figure this out. Honestly, I’m about fried for this evening, but this will be my task first thing tomorrow morning when I’m fresh and cofffee’d. I’ll post here if/when I get it right (or not). Thank you!
Okay @Zaque I feel like I’m on the verge of figuring this out, but I’m getting something wrong here with creating/using a date range object, I think. (FYI, I’ve been following @keith’s helpful tips here pretty closely Date range only one input - #6 by keith)
I’ve tried to create a custom state “daterange” on the Air/DateTimePicker REC1 (the date the user will change):
I try to set the value of daterange to the difference between its start and its end:
That seems to work, but when I then go to add the value of daterange to ESSAY1 (the subsequent date/picker that I want to “bump” forward by the number of days in daterange), I can’t seem to get it to work:
This is also probably relevant: I created two texts on the page to show the range:start and range:end for REC1. When the user updates the date of REC1, both the end and the start are the same.
Whenever I get stuck like this, I try to simplify the problem. Could you convert your date ranges into start / end date (and think carefully about if you even need the end date stored)?
Well, it ain’t pretty… but it works! Thank you very much, @Zaque!
Here’s how it now looks (note how the 2nd date always remains exactly 21 days more than the date being changed):
In case anyone is following along at a future date, here’s what finally worked:
Date Fields:
date - REC1: first sequential date (the one the user changes) ESSAY1: second sequential date (the one that needs to get “bumped” accordingly) bumpESSAY1: the number of days to bump dateREC1-old: the original date of “date - REC1”
Workflow:
store the number of days to bump (new REC1 date - old REC1 date)
update ESSAY1’s date that number of days
set “dateREC1-old” = “date - REC1” (so that it’s ready to go for next time)