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

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.

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.

Thx. That solved my problem.

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.

1 Like

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.

1 Like

Got it. Thanks.

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