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 >> Can agents perform 'group by' as well as ordering?
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1221143778

Message started by Greg Askew on Sep 11th, 2008, 10:36am

Title: Can agents perform 'group by' as well as ordering?
Post by Greg Askew on Sep 11th, 2008, 10:36am

Just a quick question for the Tinderbox elite here...

I'm currently learning how to bake rye sourdough bread - no mean feat, as I'm quickly discovering. I'm using Tinderbox as a diary through each attempt - notes for each preparatory step, and a single note that I use as an analysis of the entire procedure.

My analysis note is prototyped to include an attribute called 'Recipe', so that I can quickly determine which recipe I used in the bread making. I also have an agent that finds all the analysis notes that I've made (pattern matching the note's name with 'analysis'), and drops them into a list.

Having made a number of attempts to make my bread, I'm finding that the number of recipes and analysis notes are building up quickly. I'd now like to improve my agent's result list by sorting the analysis notes into visible groups based on the value of the note's recipe attribute (essentially a sql 'group by' clause). Within each group, I'd then 'order by' the analysis notes' creation date, to give a structure to my progress with that recipe.

I could write an agent for each recipe, however my instinct is to avoid unnecessary duplication of work where possible. Further, each time I started a new receipe, I'd have to write an additional agent. I could also use the two levels of ordering available to an agent; this option isn't scaleable, and would work only if the note's name is structured to provide an explanation of the sort sequence, otherwise the list becomes confusing - there are no obvious breaks from one recipe to the next.

Am I asking too much of agents, or is such a structured result possible?

Title: Re: Can agents perform 'group by' as well as ordering?
Post by Mark Anderson on Sep 11th, 2008, 6:14pm

(Deleted by author - see Mark B's post two down from here)

Title: Re: Can agents perform 'group by' as well as ordering?
Post by Mark Anderson on Sep 12th, 2008, 5:18pm

On topic (bread) but not TB related, I sympathise re the rye bread issue. My wife and I have been doing OK with rye sourdough bread based on the leaven in Dan Lepard's book The Handmade Loaf. Although the rye loaves taste fine, getting them to rise - and hold shape - is a different matter. On the leaven front we found it took several weeks before we got good results even though it was very active within a few days - I guess it needs to mature a little. I think the answer is a proving basket, as using home-made mock-up of said utensil has helped though I think a proper purpose-made basket is the long term answer.

Title: Re: Can agents perform 'group by' as well as ordering?
Post by Mark Bernstein on Sep 13th, 2008, 2:20am

Actually, I think this is an easy problem.

Tinderbox provides two sort parameters; SortBy and AlsoSortBy.  So, you can sort by the group, and then also sort by the secondary criteria.  In your case, you sort by Recipe, and then also sort by Version (or Date).

This gives you almost everything you want.  But what if you also would like, say, a separator to make the groups clearer?  You can do this too; just give the separator a Version or Date that will sort to the top of its group.

(Yes, you'll need to make a new separator for each group.  But that's not terribly onerous for recipes you might be revising many times. And you'll have to wait for the bread to rise anyway!

Title: Re: Can agents perform 'group by' as well as ordering?
Post by Greg Askew on Sep 13th, 2008, 8:18pm

Thanks for all of your replies. I guess that I was looking for something more... erm... 'database-ey', but I'm quite happy with the suggestions that you've both put forward. I think that my analysis processes that I undertake at work might have placed unrealistic expectations on TB! Mind you, TB isn't so far away from being an analysis tool, and I certainly wouldn't have been unconsciously grouping by attributes if the spark wasn't there!

For what it's worth, where I was heading towards was something like this:

Find all my notes in the tinderbox
where the notes name is like '%analysis%'
group by Recipe Attribute and Rye Culture Number Attribue
order by date

With a 'Greg's perfect world' result of something like:

* Agent
- * Reinhart's 100% Sourdough||Rye Culture 1
-- * 2008-08-15 Analysis (Rye Loaf 1)
-- * 2008-08-22 Analysis (Rye Loaf 2)
-- * 2008-09-01 Analysis (Rye Loaf 3)
- * Oliver's Rye Sourdough||Rye Culture 1
-- * 2008-09-10 Analysis (Rye Loaf 4)

PS. Thanks to TB, I've finally created an edible, good looking loaf of rye bread. It took four attempts, but the journaling and organization in TB kept my brain from having to try and recall six weeks of readings, practice and procedure.

By using TB, I've reduced my stress and frustration levels from making stupid mistakes through forgetfulness (each stupid mistake would have cost me 2-3 days of baking), saved money on not buying extra flour, and saved money from not having to buy lunches this week (since I can make my own).

It's the little things that all add up in the long run.

Title: Re: Can agents perform 'group by' as well as ordering?
Post by Mark Bernstein on Sep 14th, 2008, 3:22am

How's this?  You could create a synthetic attribute with the sort properties you desire -- a secondary key, for all you database fans out there.  For example:  YYYY-MM-DD AA CC, where AA is the recipe attribute and  CC is the name of the culture.  This attribute is assigned by a rule, and then we sort of the synthetic attribute. Voila!

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.