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 >> "Date earlier than" code
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1433322263

Message started by Stephen Hay on Jun 3rd, 2015, 5:04am

Title: "Date earlier than" code
Post by Stephen Hay on Jun 3rd, 2015, 5:04am

Hello,

I'm stumped.

The code below is supposed to tell me all the people / past clients / referrers / prospects I have forgotten to contact for six months. It is giving results that are only 3 months overdue (like that's a good thing...??)

$Past Client, $Referrer and $Prospect all have $Person as their $Prototype. If there is a more elegant way of expressing this, I'm all eyes.

Many thanks,
Stephen

$Prototype="Person" OR $Prototype="Past Client" OR Prototype="Referrer" OR $Prototype="Prospect" & $NextContact<date($Today-"180 days")

Title: Re: "Date earlier than" code
Post by Mark Anderson on Jun 3rd, 2015, 5:54am


Quote:
$Past Client, $Referrer and $Prospect all have $Person as their $Prototype.

The $-prefix normally refers to an attribute's:
  • In action code: a reference to the attribute's value.
  • In general writing an indication the writer is talking about a TB attribute.
I'm not sure either is the case here. Reading between the lines my assumption are:
  • you've 4 prototypes, 3 of which are also based off the other. ("Person").
  • you've a Date-type attribute $NextContact.
  • you are trying to use the date() operator to make date objects from strings
The latter is one problem.  I believe this query term:

  $NextContact<$Date("Today - 180 days")

should be:

  $NextContact<date("Today - 180 days")

So, I think you're trying to do this

($Prototype="Person" OR $Prototype="Past Client" OR Prototype="Referrer" OR $Prototype="Prospect") & $NextContact<date("today - 180 days")

($Prototype="Person" | $Prototype="Past Client" | Prototype="Referrer" | $Prototype="Prospect") & $NextContact<date("today - 180 days")

Does that help?

(changed "Today" to "today" -- ed.)

[edit]Corrected error in code[/edit]

Title: Re: "Date earlier than" code
Post by Stephen Hay on Jun 3rd, 2015, 2:51pm

It's always so elegant...

Thanks,
Stephen

Title: Re: "Date earlier than" code
Post by Mark Anderson on Jun 3rd, 2015, 2:59pm

Just corrected an error spotted in my last. I was typing during a lecture and I missed the 'OR' bit. In a query, use an ampersand '&' for an AND join and a pipe '|' for an OR join.

See the corrected code in my last post above. Sorry for missing that.

Title: Re: "Date earlier than" code
Post by Stephen Hay on Jun 5th, 2015, 6:43am

Thanks for this. After looking at the code you gave me for the "To do list forecasting", I went back to see why I needed to specify $Prototypes for this to work.

Turns out that some $Prototype=Event and some $Prototype=Organisation have acquired a $NextContact of 1/04/04 12:00am. No idea how this has happened, there is no consistency, but the numbers are relatively small (<30) so I'll fix them manually.

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.