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 by String of months
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1223590066

Message started by RobertW on Oct 9th, 2008, 6:07pm

Title: Agent by String of months
Post by RobertW on Oct 9th, 2008, 6:07pm

I'm stuck on how to do this:

I want to make an agent which will show me only produce that is actually in season.

So pretend corn (maize) is in season July, August and September and peaches are in season August, September and October.

It would show me nothing in June, just corn in July, and both corn and peaches in August.

Any puzzle solvers with a take?

Title: Re: Agent by String of months
Post by Mark Anderson on Oct 10th, 2008, 4:19am

This needs two attributes - one a string type 'CurrentMonth' and a second, set type, 'InSeason'. now make an agent with this Rule:
  CurrentMonth=month(date(today));

Add this query:
  InSeason(^getFor(agent,CurrentMonth)^)

In your produce notes set the months that it is in season as month numbers 1 through 12.  So for a seasonality range August-November, InSeason would be the Set value "8;9;10;11"

For the month at time of writing (October), CurrentMonth is 10 and so any product whose InSeason contained '10' would match.

Current practice is to use $AttributeValue codes for internal coding but I couldn't get that to work, e.g. InSeason($CurrentMonth(agent)) or the like (escaping the dollar sign \$ doesn't help).  Still, ^getFor(note,attribute)^ does work though I'd be happy if someone gave me a non-export code version of the query - if such exists.

Note that the query needs to check the 'agent' value of CurrentMonth.  Don't use the 'parent' object or each note ends up checking it's own original note's parent note's value for that attribute - not what you want.

It's perhaps worth noting that the 'agent' item object was added in v4.0.0.

Title: Re: Agent by String of months
Post by RobertW on Oct 18th, 2008, 5:43pm

So far, so good. Thanks.

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.