Tinderbox Forum

Copy content in one attribute to another

Hi there. I have what is probably a silly question. I have an attribute $keywords and I want to copy the value in $Keywords, for every note, to the attribute $Tags. How would I go about doing this?

$Tags = values("Keywords");

See the values() operator.

I see, but this operation will all keywords used across all notes into the $Tags for a note. What I’m trying to do is for each note move the current entries in that notes keywords attribute into that notes tags attribute. I want to do this across the entire file. So, when I get the operator correct my thought is that I could use a Rule to accomplish this, no?

First: attribute names are case sensitive. $keywords and $Keywords are different attributes.

The way to do this is to make an agent.

Query: true

Since true is always true, the agent will find every note in the document.

Action:. $Tags=$keywords

This will replace the value of $Tags with the value of $keywords for each note found by the agent.

Sorry, your opening question could be read several different ways and I picked the wrong one. no matter, I think the post above this one has the answer you need.

Thanks. Sorry if I’m not being clear with my question. Let me try one more attempt.

Let’s say I have 3 notes.
Note 1 has $Keywords: Apple;Juice;Orange
Note 2 has $Keywords: Shirt;Pants;Shoes
Note 2 has $Keywords:

I want to run an rule that moves the content in $Keywords to $Tags for each note so at the end of the process I have:
Note 1 has $Tags: Apple;Juice;Orange
Note 2 has $Tags: Shirt;Pants;Shoes
Note 2 has $Tags:

Later, once it is done I’ll delete the $Keywords attribute and stop the rule.

OK, use this agent query to find all notes with values(s) for $Keywords:

$Keywords

If that’s confusing, a more verbose form would be:

$Keywords != ""

So, now your agent has an alias for every note with $Keywords. Set your agent action to:

$Tags = $Tags + $Keywords;

The latter ensure that if a note has $Tags values that aren’t also in $Keywords, the latter are added to the list and don’t replace existing non-matching Tags. As for matching values, as explained above, $Tags is a Set-type so only one copy of each discrete value (by case-sensitive match) is stored in $Tags.

Eureka! Your customer service and dedication to the community is laudable. :pray::pray::pray: Thank you. Worked perfectly. I’ve learned more about Tinderbox in the last week since the community call than I have in years. So grateful to the community.

1 Like