@ZVoni:
My "to human language" translated attempt:
"something" has a start and end date, occupying a certain amount of days between them.
After the amount of days that 'something' needs to be resumed (I thought of it as for example sending a notice or resuming payments)
If the end date is at the start of a weekend then 'resuming' can't take place (people are not present in weekends) in which case the end-date (or actually resume date) has to shift over an x amount of days so that resuming takes place f.e. during office hours/days (people are present again).
I'm pretty sure this calculation can be solved in SQLite directly as a computed column.
Then you could throw your CalcField routine into the bin
Exactly my thought as well. No idea why that is a separate column stored in the DB unless that is the whole point for the code to exist (to update a database with additional/corrected information) or perhaps someone does not trust the calculation(s) and need to be stored as intermediate result.
Ron, i understood that, too.
But his DayOfWeek=6 doesn't make sense in that case
this is mystifying me completly:
If i understand it correctly, it goes like this:
ED = ST + CO-1 --> 2023-01-02 + 18-1 = 2023-01-19
DREP = ED+1 --> 2023-01-19 + 1 = 2023-01-20
Why not just
DREP = ST + CO
Because that's what math is for
That said: I understand that if a Startdate is e.g.
2023-07-01 and you add 18 days to it, math says that EndDate is 2023-07-19
BUT
If something starts on 2023-07-01 that day counts for it, too!
So EndDate would be StartDate + 18-1 = 2023-07-18
Something starts on the First, it takes 18 days, so it finishes on 18th
Understood so far, but then i don't understand, why he adds a Day again?
Because that would be a "new" StartDate, right? resp. his "Resuming Date"?
If the end date is at the start of a weekend then 'resuming' can't take place (people are not present in weekends) in which case the end-date (or actually resume date) has to shift over an x amount of days so that resuming takes place f.e. during office hours/days (people are present again).
Uhmm, no.
As far as i inderstood: If the "resuming Day" is on a Weekend (why isn't he checking if it's a Sunday?), then move forward 2 days
He's checking DREP=6 not ED=6