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
2 Query queries (Read 5837 times)
Jean Goodwin
Full Member
*
Offline



Posts: 136
North Carolina
2 Query queries
Mar 07th, 2009, 9:47am
 
4.6 is noticeably faster, and collapsing the query and action syntaxes is going to be great for my poor old brain--in the long run.  Thanks!  

Meanwhile, though, I can't figure out what I'm doing wrong in these two simple queries:

1.  "and"--e.g.
($lastMade>today-2)&($lastMade<tomorrow)
produces no results, although each works separately

I'm also curious about best practice for dates;  should we be using
$lastMade>date(today-2)
or something?

2.  set attributes, e.g.
$Topic="1"
doesn't seem to work if $Topic is a set attribute
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: 2 Query queries
Reply #1 - Mar 7th, 2009, 11:59am
 
Just tested  #2 with a set attributer 'Topic'. I set a note's OnAdd to $Topic="1" and added a child note.  The child had a $Topic value of 1. Are you citing the full syntax in which that code is applied?  In what context is it called (agent, rule, etc.?

Not sure about #1, I get the same.  One small check, is your attribute 'LastMade' or 'lastMade'. Convention - though not binding - is that attribute names use CamelCase naming. 'lastMade' and 'LastMade' are seen by TB as 2 different attributes. This us where the rule helps as if the attribute name isn't CamelCase - and thus easy to pick out in the code, then you know you've a typo.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: 2 Query queries
Reply #2 - Mar 7th, 2009, 12:06pm
 
Remember to quote your date strings (and other strings!)

($lastMade>"today-2")&($lastMade<"tomorrow")
Back to top
 
 
WWW   IP Logged
Jean Goodwin
Full Member
*
Offline



Posts: 136
North Carolina
Re: 2 Query queries
Reply #3 - Mar 7th, 2009, 1:41pm
 
Thanks, Mark2!

Question #1 is solved.  The query is still behaving very badly in my original document, but it works in a new one, so I think my data is corrupt.  Sad!

Question #2:
All of the following queries come up empty when $Topic is a set attribute:
$Topic="1"
$Topic=1
$Topic("1")
$Topic(1)
Topic("1")

But this one works:
Topic(1)
--so that problem is solved, too.  But I had thought "$" was required for all attributes now?
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: 2 Query queries
Reply #4 - Mar 7th, 2009, 2:20pm
 
Topic(1) isn't a reference to an attribute, but a pattern search against the contents of Topic for the pattern '1'. See post #4 of this thread for an (attempted) explanation of the difference from $ usage. Though it appears confusing at first sight, it's actually quite simple once you understand the logic!

Also, not the attribute(pattern) syntax - i.e. using an attribute name without a $ prefix is only used in a query which either in an AgentQuery or in a conditional statement as used in if() statements and one or two conditional action operators.
Back to top
 
« Last Edit: Mar 7th, 2009, 2:20pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: 2 Query queries
Reply #5 - Mar 7th, 2009, 2:39pm
 
In 4.6.0, when you want the value of an attribute, you refer to it with a '$': for example, $Name or $Price(parent).

When you want to SEARCH the value for a regular expression, you don't use the  '$'.  For example, Name(A) tests whether the name of this note contains an A.
Back to top
 
« Last Edit: Mar 7th, 2009, 2:50pm by Mark Bernstein »  
WWW   IP Logged
Pages: 1
Send Topic Print