How to work around <-range-> limitations

This one “when” expression was a pain to build. I figured y’all might like to see it.

So, I have “template” records that are mostly empty except for the type of data they expect and the acceptable date(s).
After a template record is used, the user can still change its contents. If the user changes it too much the entry doesn’t fit the template anymore. So I need to check if the data still fits the template’s constraints.

I don’t know of a way to store a date range, so I stored a min and max date. Those can be the same date/time. I need to spread them out to cover the full day(s) by replacing the seconds, minutes, and hours. That leaves the date the same but moves min to right at the beginning of the day and max to right at the end.

  • I need to adjust the template max/min dates down to the beginning and end of the day before putting them into the range. I can write the LEFT side of the <-range-> but as soon as I add a date to the RIGHT side it becomes a range and I can’t adjust the RIGHT date’s seconds/minutes/hours anymore. So I had to make custom states and do the adjustments in earlier steps

  • The range logic only appears after a range, not after a date, so I have to write out the x<-range->y first. range logic doesn’t have a “doesn’t contain” option for the following date. so I had to format the result as text, with yes=no and no=yes, then evaluate if the text=yes.

BTW, @emmanuel it would be nice if <-range-> didn’t have these limitations. The first one is particularly annoying.