"bump" a date by changing a previous date (while auto-binding)

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:

Screenshot 2020-06-27 14.41.11

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.

Screenshot 2020-06-27 14.41.19

can you set a workflow for when the air/date timepicker changes to modify the second date

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.

how about something like this

image

1 Like

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!

When the first value changes, can you set a custom state equal to the date change that you can refer back to when you’re calculating the second date?

1 Like

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!

1 Like

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):

Screenshot 2020-06-28 08.49.19

I try to set the value of daterange to the difference between its start and its end:

Screenshot 2020-06-28 08.49.33

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:

Any idea what I’m getting wrong here? Thanks.

What does the “issue to fix” error say? Something about data types not matching?

image

1 Like

I’ve got a bunch of unrelated errors, but here’s the relevant one, I think:

Screenshot 2020-06-28 09.38.30

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:

  1. store the number of days to bump (new REC1 date - old REC1 date)
  2. update ESSAY1’s date that number of days
  3. set “dateREC1-old” = “date - REC1” (so that it’s ready to go for next time)

Nice work @Seth