Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Agent, Actions, Rules & Automation >> Hopefully quick date arithmetic query
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1221699673

Message started by Rob Forsyth on Sep 17th, 2008, 9:01pm

Title: Hopefully quick date arithmetic query
Post by Rob Forsyth on Sep 17th, 2008, 9:01pm

Can someone help me to the correct syntax for this rule:

GoalDueDate=$AdmissionDate(parent)+14 days

doesn't give the hoped-for result (i.e. to set GoalDueDate to 14 days later than its parent's $AdmissionDate)

Title: Re: Hopefully quick date arithmetic query
Post by Mark Anderson on Sep 18th, 2008, 4:22am

I can replicate the problem. I tried brackets () around the sub-clauses to try and help YB with the order things are evaluated but that didn't help. So, I tried an extra Date-type attribute 'ExtraDate' into my test Rule:

  ExtraDate = $AdmissionDate(parent); $GoalDueDate = $ExtraDate + 14 days

Instead of getting 'never' as the result I now get a date but the wrong one.  If the parent's AdmissionDate is 2/9/08 (2 Sep - I'm in UK), the GoalDueDate of the child is 14/9/08 and not 16/9/08 as I'd expect.  It seems there is a further problem with the dates here as if I change the amount of tme added to '4 days' the result is 4/9/08. If I use '6 weeks' the result is 6/9/08. It seems the whatever extra I add (days/months/years) the number preceding that is simply set as the target date attribute's day number and not added to it.

Adding a placeholder duration to a date date attribute is allowable syntax as far as I can tell. Release note seq #1207 for version 3.0.3 has this example code:
  DueDate=$DueDate(parent)+7 days;


Title: Re: Hopefully quick date arithmetic query
Post by Mark Bernstein on Sep 18th, 2008, 12:21pm

The syntax is right; Tinderbox 4.5 is wrong.  (It's a glitch connected to historical date support, and will be fixed in 4.5.2)

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.