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
Controlling order in which agent gathers notes? (Read 3548 times)
rtalexander
Full Member
*
Offline



Posts: 37

Controlling order in which agent gathers notes?
Aug 16th, 2009, 2:43am
 
Hi,

Is there a way to have an agent process notes sorted by an attribute *before* applying an action?

For example, I have a set of notes that each correspond to a line of text in some file, and each note has an attribute, LineNumber, that captures the number of the corresponding line in the text file. Certain lines of text will have open or close braces (g.g., "{" or "}"). What I want to do is increment a counter every time a left brace appears on the line, and decrement that counter whenever a line has a right brace.  This text is sufficient regular that at most only one brace appears on a line, and if there is a brace on a line, then the line will have nothing but the brace. Yes, the text is source code, and a pair of braces denotes a scope. So the idea is that every time a open/close brace is encountered, the counter (i.e., the nesting level of scope) is incremented/decremented. For this to work correctly, the agent's action must be applied to notes that are selected and ordered by the attribute LineNumber.

Is this possible in Tinderbox?

So far, it seems that the order of notes selected by an agent is not indeterminable. I have tried using a two stage process whereby I have one agent that simply gathers the notes and sorts them by LineNumber, and then a second agent selects the relevant notes from the first agent's result. But, this does not seem to work.

Am I missing something here? Any suggestions would be greatly appreciated.

Roger Alexander.




Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Controlling order in which agent gathers notes?
Reply #1 - Aug 16th, 2009, 7:19am
 
Post-edit: see next reply

My presumption is that a Tinderbox agent processes it's aliases in (post) sort order - assuming one is set - or else on some internal order that I've never diagnosed (it seems to vary and thus may alter depending on the nature of the query - it doesn't just seem to be as simple as Outline order or or sequence of creation date, etc.).

In your experiment, does the second agent have a sort order set to LineNumber? It may be that in your two-stage process the second undoes the first, as the second agent processes it's matches in 'default' order. Did you explicitly try using just the first (sorted) agent to do the in-/de-crementing task? In the latter case, if it doesn't work it would suggest Tinderbox is processing the notes internally in an order that the user can't control. To get a handle on such things inside the app, you might do better to drop at line direct to support@eastgate.com. It may just be that a sorted agent is what you need. (I've not run a test here as I've something on the stove right now that needs attention!)
Back to top
 
« Last Edit: Aug 16th, 2009, 10:44am 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: Controlling order in which agent gathers notes?
Reply #2 - Aug 16th, 2009, 9:33am
 
Have one agent gather the notes, sorting them by line order

Let a second agent search through the notes inside the first agent, looking for the key character(s).

The count you're looking for is now the $SiblingOrder of the second agent, which that agent's OnAdd action can store in a suitable attribute.
Back to top
 
 
WWW   IP Logged
Pages: 1
Send Topic Print