We want first to collect the names of the children of Data:
collect(children(/Data),$Name)
Note the parenthesis after $Name; it’s missing in your case. Instead, you’re collecting the formatted names, which is not what you meant to do.
After you have collected these names, you want to format them with an intervening carriage return. The conventional symbol for carriage return is “\n”; you have written “/n”
collect(children(/Data),$Name) .format("\n")
If you examine the results now in the Export pane, we see what we want to see:
<body>
Uno
Dos
Tres
4
5
6
</body>
In the Preview pane, we still see Uno Dos Tres 4 5 6, because HTML ignores carriage returns. If we want to have items appear on separate lines in the preview pane, be need to insert the <br> (break) tag:
If you actually wanted the list in the $Text of the note, so that the list show birth in-app and in preview (for export) preview correct style, a rule/edict/stamp you this code is an approach:
So, lots of ways towards the same end. There is no wrong solution here (though there is code that doesn’t work!), but dependent on your task, some solutions will be more useful than others.
To explain further to @eastgate 's explanation above. …
The collect(scope, expressionStr) operator can take a (simple action) expression as its second argument. But, the list you are wishing to format doesn’t exist inside the operator. Rather it is the _output of the operator, with each child note (re children scope) contributing its $Name value as a single item of the eventual list. Thus the correction already offered above of chaining the .format() to the collect()` rather than to the $Name argument inside the operator.
Interestingly, I learned today that Tinderbox will parse this (note the space before the period of the dot-operator):
^value(collect(children(/Data),$Name) .format("/n"))^
^ space
Ideally, don’t make the app guess as it works up until the point it doesn’t which by Murphy’s Law means in a context you can’t see/didn’t expect.
Great learning case for me, as an export example. Thanks to all for the lessons.
MichaelB, @satikusala , I will be watching your session shortly. MarkA, @mwra , thanks for reminding me to use as a stamp as an alternative method. Good tip.
MarkB @eastgate , first of all, I hope you are feeling better! Thank you for the export tips. All have been written down in my learningTbx file and are being put to use as we speak.
Happy Holidays everyone and Happy New Year 2023!
Tom