So the $ShortTitle+" "+$Citation
is what is seems to be causing the issue here. To my recollection, collect
was intended for fetching all the values of an attribute from the nominated group of notes. Witness the general syntax: collect(group,attribute). The attribute is singular!
One of its prime roles was later replaces by values()
, and the arrival of find()
use in a designator (IOW a custom query designator) also eroded the role of collect_if()
.
So the first point here is should we trying (even if we want to) to use collect
for string concatenations? Anyway, as the attached TBX’s test confirms, it is the presence of parentheses ()
anywhere in the collected attribute(s) value(s) that generated the (unwanted) quotes. There is a fix though—read on.
Firstly, unless we really want to export the list as a list, rather than use .replace(";",", ")
we should use `.format(", "). Now we have a single string with a comma+space between each list item. Now, we can use .replace to string the quotes with:
.replace('\"',"")
Note in this case we do need to escape the double quote to tell Tinderbox we are citing a literal character and not opening a doube-quote-enclosed sub-string in the input parameter. The latter code also shows two further syntax points. Firstly, you can enclose the input strings in either single or double quotes as long as properly paired. Secondly you don’t have to use the same enclosing quote type for each input.
The revised action is here (line breaks in code to better fit on screen):
^action(
$MyList=collect(children("Appendix B: Summary of Relevant Theories"),$ShortTitle+" "+Citation);
)^
^value($MyList.format(", ").replace('\"',""))^
See the detail in this demo file: collect-quotes-problem.tbx (119.3 KB)
@brookter’s suggestion is also correct, but since my solution given in the thread recommended, I’ve (above) now got a better appreciation of the source problem and a simpler problem in the form of fewer replace calls.
Interesting problem, happily now solved.