Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
"Date earlier than" code (Read 1790 times)
Stephen Hay
Full Member
*
Offline



Posts: 61
Wellington NZ
"Date earlier than" code
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")
Back to top
 
« Last Edit: Jun 03rd, 2015, 5:16am by Stephen Hay »  
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: "Date earlier than" code
Reply #1 - 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.)

Edited:
Corrected error in code
Back to top
 
« Last Edit: Jun 3rd, 2015, 2:57pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Stephen Hay
Full Member
*
Offline



Posts: 61
Wellington NZ
Re: "Date earlier than" code
Reply #2 - Jun 3rd, 2015, 2:51pm
 
It's always so elegant...

Thanks,
Stephen
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: "Date earlier than" code
Reply #3 - 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.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Stephen Hay
Full Member
*
Offline



Posts: 61
Wellington NZ
Re: "Date earlier than" code
Reply #4 - 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.
Back to top
 
« Last Edit: Jun 5th, 2015, 6:51am by Stephen Hay »  
  IP Logged
Pages: 1
Send Topic Print