Stamp to prepend an attribute of set type to $Text

Each of my “notes” has an attribute, Sectors, which is a set containing 0 or more stock sectors pertaining to the note. I would like to define a stamp that redefines a note’s $Text by prepending the set, Sectors, to $Text. I’ve been experimenting with a Stamp action such as:
$Text=$NoteDate.format(l) + “\n” + $Sectors.format(??) “\n” + $Text
For ??, I’ve tried ", " but the attribute value doesn’t add to the revised Text. I’ve not even sure using .format is the right approach. If I remove the $Sectors… part, then the note is correctly changed to, say,

2024-01-10
A test note.

where “A test note.” was the original $Text value for the note.

So, how do I convert a set/list to a string? I will have two such set attributes to prepend along with the NoteDate.

Background: I have some agents that gather notes pertaining to stock data. Each agent includes the Rule:
$Text=collect(descendants,$Text).format(“\n----------\n”)
and the resulting Text that the agent displays will be copy & pasted to a Filemaker database, so I want the NoteDate and the set attributes to be part of each note and thus included in the rule’s collection.

Thanks for any insight you may provide!

.format() for lists and sets takes a string to be used to separate elements. So:

$Text=$Sectors.format(",") + "\n\n"+$Text;

should do what you want.

Thanks for the suggestion (which I originally tried, but it failed). But I typed in your sample code and that did work.

Having been bitten by the curly quotes bug several times yesterday, I can only guess that I once again used them for “,” in my first attempt. I have got to pay attention to those quote characters!

At any rate, I wrote the action code that includes all the pre-pended info I need. It works like a charm now. Thanks again!

BTW, here is a tip…if you are drafting your action code in a text note you can toggle the $SmartQuotes attribute on and off. Turning it to false will tell Tinderbox NOT to convert your quotes to curly quotes.