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
Agent adding/removing badge (Read 3423 times)
Ben Worthington
Full Member
*
Offline



Posts: 110

Agent adding/removing badge
Aug 13th, 2014, 11:02am
 
I have two agents:

1) One agent looks for notes (of $Prototype p_case) which have not been tagged:

     $Prototype=="p_case" & $Tag==ď"

and adds a badge to them:

      †$Badge=ď1620Ē

2) the other agent removes the badge when a note receives a tag i.e.

     Query:      $Badge=="1620" & $Tag!=ďĒ
     Action: † † $Badge==ďNone"


This seemed to work ok but Iíve now got an issue where the badge is being added and removed every few seconds even where I do not change the status of the tags.

Any ideas as to what I am overlooking here?

Thank you

Ben
Back to top
 
« Last Edit: Aug 13th, 2014, 11:03am by Ben Worthington »  
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Agent adding/removing badge
Reply #1 - Aug 13th, 2014, 11:49am
 
It may just be Safari messing with quote styles but a number of your double-qutes aren't 'straight', for example (in red):

Quote:
$Prototype=="p_case" & $Tag==ď"


I'd first double check those quotes are of the correct type and if not see if fixing that gets rid of the problem. If you're using a note $Text to initially write out your code before applying it, use a note with the built-in 'Code' prototype applied as this fixes the smart quote problem.

Otherwise it's not clear why this is happening but you might trying reversing the outline order of the agents. It would be simpler to use one agent:

Query: $Prototype=="p_case"

Action: if($Tag=""){$Badge="1620"}else{$Badge=;}

If notes using p_case don't need their $Rule for other purposes you could lose the agent altogether and use the above action as the $Rule for the 'p_case' prototype.
Back to top
 
 

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



Posts: 110

Re: Agent adding/removing badge
Reply #2 - Aug 13th, 2014, 12:43pm
 
Thanks Mark.

The quotes were fine in the document.  However, using your action code as a rule seems to have solved the problem.

Thanks again,

Ben
Back to top
 
 
  IP Logged
patrickallo
Full Member
*
Offline



Posts: 3

Re: Agent adding/removing badge
Reply #3 - Nov 20th, 2014, 6:25am
 
I have a similar issue.
Basically I have two agents with mutually exclusive queries, namely

Quote:
$Scheduled==True and $Scheduled==False

but both agents end up with exactly the same notes, which causes the flipfloping effects.

For me as well the if-then-else action on a single agents gives the intended result, but it's still puzzling.
Back to top
 
 
  IP Logged
J Fallows
Full Member
*
Offline



Posts: 418

Re: Agent adding/removing badge
Reply #4 - Nov 20th, 2014, 9:52am
 
Quote:
$Scheduled==True and $Scheduled==False


I believe that Boolean attributes are case sensitive and take values of true and false, all lower case. Might it be something this simple?
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Agent adding/removing badge
Reply #5 - Nov 20th, 2014, 10:45am
 
Yep, I think it is that simple.

The keyword false is (of course) false.

The empty string is false; other string are true. †That means the string "False" is not false; itís true! †

The string "false" is also likely to be true, unless Tinderbox evaluates it in a context where itís evaluated and coerced to a Boolean. †In that case, itís possible that Tinderbox would strip the quotes and treat false as a keyword. Donít rely on edge cases like this!
Back to top
 
« Last Edit: Nov 20th, 2014, 10:45am by Mark Bernstein »  
WWW   IP Logged
patrickallo
Full Member
*
Offline



Posts: 3

Re: Agent adding/removing badge
Reply #6 - Nov 21st, 2014, 4:22pm
 
Thanks. That was indeed the issue (even though I thought I had tried both False and false).
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print