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 >> A simple action to Promote the children
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1476272149

Message started by Desalegn on Oct 12th, 2016, 7:35am

Title: A simple action to Promote the children
Post by Desalegn on Oct 12th, 2016, 7:35am

Can sb tell me how put an addon to promote the children of a container?

I have a couple of containers.  I want to flatten them out. I can manually fallen them out by Shift+TAB: but, that will be tedious in the long run.

I tried to put an addon on a Prototype like this:


Code:
$Container=$Path(parent)


doesn't seem to work. Any easy way?

Title: Re: A simple action to Promote the children
Post by Mark Anderson on Oct 12th, 2016, 8:22am

The $OnAdd only fires when a note is added to the container (using that prototype). I suggest 2 methods - in no particular order.

1. Use a Stamp
Here we select the items to promote and the stamp code is:

  $Container=$Container(parent);

However, in most cases using Shift-Tab on the selection is as easy. So…

2. Agent. Use a query to find the relevant notes. It is important to remember that the agent action is applied to the alias inside that agent but that we want the effect to apply to the original note of the alias. Therefore, the action is:

  $Container(original) = $Container(parent(original));

Note that 'original' and 'parent' aren't in quotes in the code to make clear they are designators and not literal string value as in a title or path value.

Title: Re: A simple action to Promote the children
Post by Mark Bernstein on Oct 12th, 2016, 11:27am

$Container=$Path(parent) would not, in any case, move the note, since this sets the container to be the note's parent.  You probably mean $Container=$Path(grandparent)

If you make a note with the onAdd action $Container=$Path(grandparent), then notes added to that container will “bounce” out to become the container’s sibling.  

If you made a rule $Container=$Path(grandparent) (don't do this!), then the note would continuously move itself to the top level.  Fortunately, Tinderbox happens to recognize that, once the note gets to the top level, there is no grandparent container and Tinderbox does the right thing. Phew!



Title: Re: A simple action to Promote the children
Post by Desalegn on Oct 12th, 2016, 2:02pm



Quote:
If you make a note with the onAdd action $Container=$Path(grandparent), then notes added to that container will “bounce” out to become the container’s sibling.
worked beautifully.

I need to look closely to  Mark Anderson's Agent: seems the long term solution; as I am going to dump many text files into TB.

Great! Thank you guys.

Title: Re: A simple action to Promote the children
Post by Mark Anderson on Oct 12th, 2016, 4:20pm


Quote:
as I am going to dump many text files into TB


So, I'd test the action part of the agent in a small test fill so you're confident with the result. Then, for each of your real-world sets of data you just need to set the correct agent query, then apply the code. Again, for the first actual run, I'd make the agent with no action, check the right notes are found and only then add the action code. In the latter case, if you have automatic agent updates off (default is on - see File menu) then you'll need to refresh the agent via the File menu to ensure the new action code is run.

Good luck with the imports. I do this sort of thing a lot and it works very well. Don't overlook the 'spreadsheet' type import as this can auto-populate system/user attribute for you saving you digging it out of the imported text - see more.

Title: Re: A simple action to Promote the children
Post by Desalegn on Oct 22nd, 2016, 1:14pm


Quote:
$Container(original) = $Container(parent(original));


This very useful agent. I am now able to easily archive away the notes I don't need any more.


Code:
$Container(original) = $Path("archive");


Thank you.

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.