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 >> Agent adding/removing badge
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1407942141

Message started by Ben Worthington on Aug 13th, 2014, 11:02am

Title: Agent adding/removing badge
Post by Ben Worthington on 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

Title: Re: Agent adding/removing badge
Post by Mark Anderson on 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.

Title: Re: Agent adding/removing badge
Post by Ben Worthington on 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

Title: Re: Agent adding/removing badge
Post by patrickallo on 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.

Title: Re: Agent adding/removing badge
Post by J Fallows on 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?

Title: Re: Agent adding/removing badge
Post by Mark Bernstein on 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!

Title: Re: Agent adding/removing badge
Post by patrickallo on Nov 21st, 2014, 4:22pm

Thanks. That was indeed the issue (even though I thought I had tried both False and false).

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.