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 to select only recent searched notes (Read 8768 times)
John Kendrick
Full Member
*
Offline



Posts: 66

Agent to select only recent searched notes
Sep 07th, 2009, 8:25pm
 
I've combed the coding language for restricting agent searches to recent notes and nothing jumps out at me. Strikes me as simple and me as dumb.

I want to search journal entry based notes but consider any note that is older than a week out of bounds. How I do I do that?

Thanks in advance,

John Kendrick
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Agent to select only recent searched notes
Reply #1 - Sep 7th, 2009, 9:39pm
 
How about

      AgentQuery: $Created>("today - 7 days") & .....

$Created is the time that a note was first created; $Modified is the time its text was last modified.
Back to top
 
 
WWW   IP Logged
John Kendrick
Full Member
*
Offline



Posts: 66

Re: Agent to select only recent searched notes
Reply #2 - Sep 8th, 2009, 9:26am
 
Thanks for the quick response, Mark. Worked like a charm.

Though I had to get up to speed on agents. To this point I've only used them as simple search agents--pop a word or symbol in the query box.

First time I've used any sort of conditional on a search. So it took me a bit to see just how and where to put the code.

Again, thanks,

John Kendrick  Smiley
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Agent to select only recent searched notes
Reply #3 - Sep 8th, 2009, 9:54am
 
If your needed expression looks too complex for a single query, don't forget you can make a one agent look at the contents of another agent. So 'Agent Task 1' might do some query and a second agent might start it's query with inside(Agent Task 1) adding extra query terms to further restrict the list of matches.

When getting comfortable with use of agents, chunking the process like this, into several steps, can help reveal the structure.  Once that's clear you may then be able to join the successive queries into one query and thus use a single agent. Don't overlook how you scope your queries as a way to control efficiency.
Back to top
 
 

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



Posts: 66

Re: Agent to select only recent searched notes
Reply #4 - Sep 8th, 2009, 10:15am
 
Thanks yet again.

Here's the problem we are working our way through. My wife and I take daily notes on stocks we wish to trade, largely technical analysis stuff. So the Tinderbox file is labeled something like "Journal." Within "Journal", each note is a date. The text in each note can cover anywhere from one stock to ten or even, in one case, twelve.

We would like to have the agent find the references to a given stock across a week's work. And then either create a new note with only the paragraph of information on that stock (not the full note) or enter any new information (a new date entry added) into a preexisting note for that stock.

At the moment, the problem is that any simple search finds the full note; not the chunk of text for that stock.

The alternative is to avoid the agent business altogether. Have a file or a note for each stock and simply enter the information for that stock whenever something new occurs.

We would, if possible, however, prefer the date based record keeping. Then use agents to create usable information.

I simply can't tell whether our preferred option is available within Tinderbox.

John
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Agent to select only recent searched notes
Reply #5 - Sep 8th, 2009, 12:32pm
 
The problem is you want a feature that doesn't exist: a method to return only the paragraph of a note's text that contains a search term. already this begs the question, just the first (matched) paragraph? What if there is more than one.  There is probably a way to achieve your aim using a command line but the code for that would need someone with CL expertise and depending on the code used I don't know it would affect performance.

Quote:
Have a file or a note for each stock and simply enter the information for that stock whenever something new occurs.
This shuts out a lot analysis too as data too intermingled at note body-text level.

The classic TB device for dealing with this lack of specifics is to subdivide the source. So, instead of a note tracking six stocks you simply use one note per stock. Of course, whilst that solves TB's problem it might make the user chafe. Still, give that a try - after overcoming the creative dissonance of starting from a different conceptual model you may find it works - even if only insofar as it allows you to do the analysis you want.If you go that route, make a 'p_Stock' prototype which can use a few custom attributes like $Recommend, $Price, $Source, $TickerSymbol which can be displayed as key attributes. Now in your daily (or weekly, etc.) container make the OnAdd action $Prototype = "p_Stock";. Reproting another stock?  Add a new sibling note.  If you track certain stock a lot you could have prototypes based on the p_Stock. For instance p_Apple might inherit from p_Stock but have all Apple's stock ticker, URL, company name info, etc., pre-populated.  In the above scenario you'd make a new note and just change the prototype to the Apple one.

You might like to consider using a nested set of Year -> Month containers. This would aid scoping agents.  Now to look for APPL, we might first say:

($Year=="2009")&($Month=="June"|$Month="July")...

OK, that assumes you've populated some custom Year and Month attributes but you can see how easy it becomes to scope your search. Add stoke name to end of above and you'll get all the instances of it in June/July 2009.

For analysis, you can use things like Nakakoji view to give you review-type reports.  Auto-making new TB notes with such info is probably (Mark B will correct me) not easily possible but by taking the approach above you may obviate some of those needs.

Anyway.  I how that gives you some ideas.
Back to top
 
 

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



Posts: 66

Re: Agent to select only recent searched notes
Reply #6 - Sep 8th, 2009, 2:05pm
 
Thanks for the reply. I expected that would be the case. But I had to ask. Smiley

Given some of the near magic I've seen in some of these recommended TB coding exercises, I thought it just might be possible.

We'll go back to the drawing board.

John K.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Agent to select only recent searched notes
Reply #7 - Sep 8th, 2009, 3:26pm
 
If you've existing data and intend to try the method I've outlined, don't forget to leverage Explode to split up your multi-paragraph notes into paragraphs you can use in your per-company notes.

The threads on textual analysis (see the Tinderbox applications) earlier in the summer delved into breaking paragraphs so you might find it of interest to take a look at those and see if there's anything that might help you.
Back to top
 
 

--
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: Agent to select only recent searched notes
Reply #8 - Sep 8th, 2009, 3:50pm
 
One thing that occurs to me is that you might be better off creating a container of notes per day:

       Friday Research Notes
            AAPL
            MSFT
            X

instead of creating one big research note.  You could use HTMLView on the container if you like to build a nicely formatted overview of the entire day's notes, while giving agents more precise ability to select exactly the material of interest.
Back to top
 
 
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Agent to select only recent searched notes
Reply #9 - Sep 8th, 2009, 4:15pm
 
Here's a demo TBX of my earlier idea (right-click link to download). Below is what it looks like when first opened:



To try it out, delete note '2009' and its contents. Select 'Reports' and shift+Enter to make a new child note - give it any name.  It will be automatically set to this year by the p_Year prototype. Shift+Enter '2009' to make a new child note and you'll get a month note called 'September'. Make a child of that and you'll get a stock report note ready to populate. If you want a 2008 year note make a sibling to '2009', let it auto-populate and then manually set the note's $Year to 2008 and it will caption/sort correctly.  Reports reverse sorts contents by Year. Years reverse sort contents by Month. Months sort reports by Name, A-Z case-insensitively.

You'll doubtless want to change the actual note part but it just shows what you can do!
Back to top
 
« Last Edit: Sep 9th, 2009, 2:58am by Mark Anderson »  

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



Posts: 66

Re: Agent to select only recent searched notes
Reply #10 - Sep 8th, 2009, 6:55pm
 
Thanks again, Mark and Mark.

I'm going to think about all this and try some of your suggestions plus some different thoughts of mine that your suggestions prompted.

I've bookmarked this page for future reference.

John Kendrick
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Agent to select only recent searched notes
Reply #11 - Sep 9th, 2009, 3:27pm
 
Just updated the TBX with a little polish; download from the same link above. Kudos to Mark B for the suggested changes.

The issue was that the Year prototype used a user attribute 'Year' for the DisplayExpression (DE) but Year was being set via a Rule. But I discovered - the hard way - that whilst DE fires every re-draw of the window, Rule does so on every agent cycle (a slower cycle in this context) so DE - on first pass - came up empty handed and gave an unexpected DE. Help fixing that led to Mark B's much more elegant solution - see the TBX for the detail. I'd love to say it was my idea, but I'd be fibbing...
Back to top
 
 

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



Posts: 66

Re: Agent to select only recent searched notes
Reply #12 - Sep 9th, 2009, 3:37pm
 
Great stuff.

We are at the drawing board as I type. Not certain what will come out of it. We are basically rethinking the work flow.

John
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print