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
using OnAdd Action (Read 4050 times)
Jessica Abel
Full Member
*
Offline



Posts: 6

using OnAdd Action
Feb 21st, 2013, 4:42am
 
As a continuation of the previous thread about the Radio book, I'm clearly doing something wrong with OnAdd Action, but not sure what it is. I have imported all my audio logs from Scrivener (that is, not transcriptions, but running notes on interviews and so on), and they've retained the folder structure from there. [is there a way to import comments/footnotes from Scrivener, by the way?]

show
>staff member
>>date/title of log
>staff member
>>date/title of log

I've created a prototype for AudioLogs that has key attributes of $Staff, $show, and $StartDate for the day the interview happened. $staff and $show are list attributes (so far...not sure if this is the right type)

so...as I break down the logs into bits, I want to make sure each note has the AudioLogs prototype, and then that it takes on the $staff and $show and $StartDate values in the container note.

for the [show name] top level container, I put
$Prototype="pAudioLog"
in the OnAdd Action field.

In the note for the individual log, I filled in values (just typed them in--is there a way to have a popup list?) and then put this in the OnAdd Action.
$Staff|=$Staff(parent);$Show|=$Show(parent);$StartDate|=$StartDate(parent)

then I created some test notes, put them in the log/container and...nothing happened. What am I doing wrong?

thanks--

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

User - not staff!

Posts: 5689
Southsea, UK
Re: using OnAdd Action
Reply #1 - Feb 21st, 2013, 6:13am
 
Edited:
no censure implied by moving this thread. The move is just making it more easily findable for the general forum user and for later readers.


Quote:
key attributes of $Staff, $show, and $StartDate for the day the interview happened. $staff and $show are

Tinderbox attribute names are case sensitive (see more) so $Staff and $staff refer to two discrete attributes. This may be part of your problem. Also see more on coding conventions in TB.

Scrivener import.  I assume you're using the "Import from Scrivener" feature?  If content in the Scrivener file doesn't show up in the resulting TB file, the short answer to your question is no. Depending on the amount of data there might be some sort of workaround though: either by moving the Scrivener notes into a part of its doc that does import, or, finding a way to export those notes from Scrivener such as can be imported to TB via other means and reunited with their source (former of the two seems a better approach).

Quote:
for the [show name] top level container, I put
$Prototype="pAudioLog"
in the OnAdd Action field.

That code syntax is correct. Assuming "pAudioLog" is a prototype note, then notes newly added to or newly created in the container will receive that prototype. Pre-existing child notes -i.e. before you did the $OnAdd code - are unaffected. Let's set the correct prototype for the latter and reset their key attributes. Likely you've experimented with the latter in existing notes, so a reset is needed so they inherit from the prototype and show the correct key attributes.
  • Select all those pre-existing children.
  • Open the Inspector (Cmd+1).
  • In the top 2 pop-ups select 'General' and 'Prototype'.
  • Type pAudioLog in the input box.
  • Click the Apply button.
  • Reset the 2 top pop-ups to 'TextFormat' and 'KeyAttributes'.
  • Click the 'Use default' button (bottom left).
  • Other attributes you might want to reset for inheritance are rules (pop-ups: General & Rule), display expressions (pop-ups: General & DisplayExpression), and OnAdd (pop-ups: General & OnAdd).
More on resetting attribute defaults.

Quote:
In the note for the individual log, I filled in values (just typed them in--is there a way to have a popup list?)

See populating key attribute value lists.

Quote:
and then put this in the OnAdd Action.
$Staff|=$Staff(parent);$Show|=$Show(parent);$StartDate|=$StartDate(parent)

So, you're adding this code to the red notes (below) in your hierarchy?

show
>staff member
>>date/title of log
>staff member
>>date/title of log

Otherwise can you clarify which of the above is the "individual log". Indeed if there is more than one such log file you want to use the prototype method to seed the $OnAdd (as above) taking care to reset any existing files where you've already set affected attributes locally. By the last I mean that, for instance, if I set $Border as a key attribute in a note and then set the note's prototype to Event, I won't see the Event-inherited key attributes until/unless I reset the local note's $KeyAttributes. A local value always trumps an inherited one. This will make more sense once actual done by you for real, as opposed to just reading about it, and it's very intuitive once learned!

Possible other issues here:
  • Are you using the correct letter case for the attributes you've created? Ealier you refer to $show but use $Show here.
  • If the $OnAdd is truly in the date/title of log, likely the show data is in its great-gandparent note and not its parent. Consider this hierarchy: show>staff member>>date/title of log>>>new note. When you add a new note 'parent' is looking at the value in the date/title of log note which is not, I think, your intent.


Back to top
 
« Last Edit: Feb 21st, 2013, 6:43am by Mark Anderson »  

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



Posts: 6

Re: using OnAdd Action
Reply #2 - Mar 4th, 2013, 3:42pm
 
After a week of family flu, I'm back...

first, sorry for the sloppy typing. In my actual coding, I've used all initial caps--consistent names for attributes.

So, some refinement:

Part of the problem is using OnAdd action to have the pAudioLog prototype applied to grandchildren, the "date/title of log". And then great-grandchildren, the individual quotes from these logs, that I'm trying to break out. Is there a way to set things so that this happens?

secondly: yes, I want to apply the code here:

and then put this in the OnAdd Action.
$Staff|=$Staff(parent);$Show|=$Show(parent);$StartDate|=$StartDate(parent)

to all notes that are children to a specific log. There are dozens of logs, each identified by date, people present, show, and subject. From within each log, I'm breaking out quotes and info that should all then retain that ID info. The idea is, once I break all that stuff out, I'll mark it up and move it around in other ways, like by theme or the piece under discussion, but it will retain its ID info to tell me where it came from when I have to find it on the original tapes. So that code in OnAdd Action is my attempt to automate IDing the bits.

So far, nothing is happening, whether I create a note, and then drag it to the right to be a child note, or whether I then hit return and it's a child from its creation. Seems to me at this point that it may have to do with too many generations...

[I don't know how to quote properly here, but...]
"If the $OnAdd is truly in the date/title of log, likely the show data is in its great-gandparent note and not its parent. Consider this hierarchy: show>staff member>>date/title of log>>>new note. When you add a new note 'parent' is looking at the value in the date/title of log note which is not, I think, your intent."

Yes, my intent it to take the values for $Show and $Staff from the individual log ("date/title of log") to the new notes, not from higher in the hierarchy. And so, yes, the idea is to have the OnAdd Action in the log note. (Although it's not getting there automatically at this point--another issue). But the log has already inherited the protoype from a parent, maybe that's the problem?

One question with your $Border example: if you make $Border a key attribute, and then add the prototype Events, will OTHER key attributes get added? I mean, like say $Color, for example, assuming you haven't individually set the color. Or will the fact that you've set anything at all individually trump ALL the prototype attributes? I'm thinking not, but a bit confused.

thanks--

Jessica

Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: using OnAdd Action
Reply #3 - Mar 4th, 2013, 4:37pm
 
To quote, select the text to be quoted then click the page-with-arrow button in the top row above the message typing box (12th button in the row).

To see how your reply will look without doing a full preview, look up above the drafting box to the top of the 'Post Reply' section and client the plus (+) sign next to the caption 'Live Preview'.

Now let's deal with your the last item first. I'm not 100% sure about whether you're talking about which attributes are shown as key attributes and/or the values you show. The $KeyAttributes set-type attribute holds (or inherits) a list of attributes to be shown in a note (listed in order of display, top to bottom). If a note inherits $KeyAttributes - my abbreviation: KA - then that breaks KA inheritance. If the prototype KAs change the note using the prototype won't change as its KA value, i.e. the list of which items to show as KAs, because its $KeyAttributes value is now local.

The value shown in any individual attribute shown as a KA is simply that attribute's value inherited or local. The KA only controls which attributes are displayed at the top of a text window and not the actual value of those attributes.

[later - typos]
Back to top
 
« Last Edit: Mar 6th, 2013, 8:09am by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: using OnAdd Action
Reply #4 - Mar 4th, 2013, 4:44pm
 
Is the next problem that you want a container to set prototype for its grandchildren? If so, you can't to that in one step via OnAdd because the 'show' note doesn't get informed of things added to its children. I think the simplest solution is to have a prototype 'pStaff'. The $OnAdd of nore 'show' (or a pShow prototype) is:

$Prototype="pStaff"; $Show|=$Show(parent)

The $OnAdd of the 'pStaff' prototype is:

$Staff|=$Staff(parent);$Show|=$Show(parent);$StartDate|=$StartDate(parent)
Back to top
 
« Last Edit: Mar 4th, 2013, 4:44pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Pages: 1
Send Topic Print