Can the user create the body of a note from a RULE?


(Richard Bullen) #1

I want to create a note that presents a number of attributes and some additional text in the body of the note. Hopefully formatted to be readable.
I got as far as setting the body of the note to display one of the attributes using a rule viz:

$Text=$Tags

However, I’m puzzled about how to concatenate several attributes and then show them on different lines within the body.

In addition to adding attributes is it possible to pull the body text from another note and insert it into this target note?

I’d appreciate any pointers to get me started or point out the error of my ways.

Thanks.


(Paul Walters) #2

You can use + to concatenate and “\n” to split items into lines. Tinderbox interprets “\n” as a new line command.

So, for example for a note whose $Name is “My Note” and that has a red $Color, use:

$Text=$Name + "\n" + $Color;

to get

My Note
Red

If you want to put the contents of $Tags (a list attribute) on separate lines, use

$Text=$Tags.format("\n");

If you want to put the text of “My Note” into another note, then use

$Text=$Text("My Note");

This technique can be used for other attributes as well.


(Richard Bullen) #3

Thx. That solved my problem.


(Paul Walters) #4

Going to the title of your post. Creating $Text from a rule will possibly cause a lot of processing without much benefit. Consider using a low priority agent, or an edict, or an on-add action, or even a stamp.


(eastgate) #5

Expanding on this answer just a bit, remember that rules run constantly. So, if your rule is writing a novel or folding a pheasant, Tinderbox will do that — and then do it again, and again and again.

That’s probably not what you want. But if you aren’t doing something terribly complicated, a rule might be just the ticket.

An agent does its work periodically; that might be better.

An edict does its work occasionally; that might be even better.

OnAdd actions and stamps do their work once; that might be what you want.


(Richard Bullen) #6

Got it. Thanks.

I converted the process to OnAdd and got the result I wanted.