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 >> Having child notes inherit parent attribute values
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1223472549

Message started by Marisa Antonaya on Oct 8th, 2008, 9:29am

Title: Having child notes inherit parent attribute values
Post by Marisa Antonaya on Oct 8th, 2008, 9:29am

Hello everyone,

I'm setting up a teaching and research file, and have a question about making it easier for some notes to inherit attribute values.

I've create a prototype called protoBiblio, which will be used for research notes. For this, I've created a set of attributes such as Author, Title, etc. What I'd like is to tell this prototype that notes using this prototype should pass on the attribute values (the title of the article or book, the author's name...) to children. This is because I break up my research of each article into several notes: a parent note with the name of the book or article, and child notes on with snippets of quotes or ideas that will be used separately in my teaching/writing. I'd basically like to avoid having to fill out the attribute fields over and over again for notes that refer to the same work. So this way, when I make one of these child notes, all the fields would fill in automatically.

Is this possible? And if so, how would it affect (if at all) alias notes placed under different parents or agents?

Thanks for your help!
Marisa

Title: Re: Having child notes inherit parent attribute values
Post by Sebastian Stephenson on Oct 8th, 2008, 9:37am

hi

just to say that I am a tinderbox newbie but I think you want to look at the stamps feature(under the 'values' menu bar item ) they are details in the tinderbox user manual that comes with it and you should find out more there its on page 108

I have not used this personally but I think this maybe what you are looking for

hope this helps

Title: Re: Having child notes inherit parent attribute values
Post by Marisa Antonaya on Oct 8th, 2008, 9:58am

Hi Sebastian,

Thanks for such a quick reply!

I normally use stamps to quickly assign prototypes to new notes. It would be very time-consuming, I think, to create a separate stamp for every title, author, publication, etc. I have in the file (and will have in the future). I think what I'm looking for now is some sort of OnAdd action that would be executed whenever I add a child note. I've looked for an example of this in the manual, but no luck. Since most of my prior use of TB has been with website export and management, I'm woefully ignorant of many things concerning actions... :-[  ;D


Marisa

Title: Re: Having child notes inherit parent attribute values
Post by Mark Bernstein on Oct 8th, 2008, 11:41am

The container's OnAdd action can set the child's attributes.  For example, suppose all the books inside GIBBON should have their Keywords contain "Gibbon".

     OnAdd: Keywords = $Keywords+"Gibbon"

Or, the children might use a Rule to grab settings from their container:

     Rule: Topic |= $Topic(parent)

This means, "If I have no topic, set my topic to whatever topic my parent has.  If I do have a topic already, though, leave it alone."

Title: Re: Having child notes inherit parent attribute values
Post by Johnnie Wilcox - mistersquid on Oct 8th, 2008, 12:41pm

Mark's answer is the most direct solution for your issue, Marisa.

Another approach is to create a prototype that inherits the attributes from its parent if that attribute is empty. The way to do this is to give the prototype a Rule of the form


Code:
if (!Author) {Author=$Author(parent)}


This Rule tells the prototype (and notes with it as a prototype) that if the Author attribute is blank to inherit the Author of its parent. You can customize the rule to alter a series of attributes based on one attribute or to assign each attribute independently. This approach avoids clobbering any data that might be present should you decide to move the note, change the Author manually, and move the note back in. The code can also be used in the "OnAdd" field in Mark's suggested approach.

A 3rd approach is to create an agent that gathers the notes you are interested in and to use the code to assign attributes in the "Action" field of the agent.

hth

Title: Re: Having child notes inherit parent attribute values
Post by Marisa Antonaya on Oct 8th, 2008, 1:35pm

Thanks, everyone. I feel I have a better grasp of what I need to do now, so I'll start experimenting.

The child notes wouldn't be moved away from their parents, but I would create aliases to help link them to my lecture topics; so I'll see how setting up such actions affects the aliases.

Title: Re: Having child notes inherit parent attribute values
Post by Willem Smelik on Oct 27th, 2008, 2:45pm

I tried to set up the following: a parent of prototype A, whose children are prototype B.

The idea is that I drop references from BibDesk in this container. But I cannot find exactly what makes the children get prototype B as an attribute automatically.

Title: Re: Having child notes inherit parent attribute values
Post by Mark Anderson on Oct 27th, 2008, 2:52pm

OK, so the container (of Prototype "A") should have any (new) children be of Prototype "B"? If so, make the container's OnAdd action:
 Prototype = "B";
The OnAdd action is the action taken on any new note - whether created from new or existing notes moved/dropped into the container.

Title: Re: Having child notes inherit parent attribute values
Post by Willem Smelik on Oct 27th, 2008, 3:09pm

I thought I tried that one; but I forgot the quotation marks... Indeed this is the simple answer I was looking for! Thanks so much

Title: Re: Having child notes inherit parent attribute values
Post by Mark Anderson on Oct 27th, 2008, 5:59pm

If the Prototype name is a single name you might not need quotes but you will need them if the target (prototype) note name includes a space.

Title: Re: Having child notes inherit parent attribute values
Post by Willem Smelik on Oct 28th, 2008, 2:44pm

In this case, it includes a hyphen but not a space ("to-do")

Title: Re: Having child notes inherit parent attribute values
Post by Mark Anderson on Oct 28th, 2008, 3:02pm

Ah, a hyphen is the same typed (if not intended) character as a minus.  TB probably thinks you're looking for a notes whose name is the results of subtracting the string "do" from the string "do". If you had a name of 'to+do' (without the quotes) the ambiguity might seem a bit clearer. To make plain to TB that the '-' in 'to-do' is a hyphen and not an expression minus operator enclose the whole name in double quotes, e.g. "to-do".

This is why, if uncertain you should enclose explicit text in double quotes. It stops TB having to guess, perhaps incorrectly, which of several possible interpretations of the input presented is the one you intended!



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.