Tinderbox Forum

Getting $Name of notes in $MySet

Here is a sample file with 4 notes. NoteA and NoteD have been tagged as Cat1.
My agent finds the two notes just fine.

Question: how do I get the names of both notes into $MySet as NoteA,NoteD besides using the children designator. Is there a way to use collect_if to find the notes with the tags.

FindingSimilarNotes.tbx (81.5 KB)


How about $MySet=collect_if(all,$Tags.contains("Cat1"),$Name)

1 Like

or go up the note tree and find the first note where the attribute has a value:

function getAttOfTree_db(myAtt){
	return collect_if(ancestors,eval(myAtt)!="",eval(myAtt)).first

Thank you both, I realize what I was doing wrong in my attempts was placing the collect_if statement in the $Query rather than correctly in the $Rule or $Edict pane.

Detlef’s example made me think of today’s Meetup focused on functions. I am noticing Detlef used 3 operators: return, collect_if, eval and first that I am new to. Great example for me to learn to tie them together.


1 Like