I am fiddling with exporting for the first time (!) and realizing that I want to replace $Text for notes under a certain prototype. I’ve chosen to do this with a stamp as it’s worked well before, but this time I am using action code that contains " marks and so the stamp is stopping the $Text replace when it finds those "s.
The stamp I’m trying is: $Text="Participant: ^value($PID)^, Data Item: ^value($DID)^ ^action($MyList=$Tags;$MyList=$MyList.format("<ul>","<li>","</li>","</ul>");)^^value($MyList)^"
And it breaks at the first " in $MyList.format.
First, is there a better way?
Second, if this is an okay way, how to escape those quotes? (I tried \" but it didn’t work.)
$Text='Participant: ^value($PID)^, Data Item: ^value($DID)^ ^action($MyList=$Tags;$MyList=$MyList.format("<ul>","<li>","</li>","</ul>");)^^value($MyList)^';
Although the general convention is to use double (straight) quotes to delimit strings, you can indeed use either. If, as here, you use both types, ensure they are nested properly. Here all the double quotes are inside the string formed by the outer set of single quotes.
This is important as single/double straight quotes cannot be escaped using a backslash.
Note how you can still use the $Text of the note for actual text as the template doesn’t use the $text in the export. Both Set and List type attributes ‘lists’—i.e. multi-value—so you can apply the 4-input list formatting as shown above and in the demo file.
Great! The pay-off for ‘some assembly required’ rather than a black-box feature for export is you can do some wonderfully rich things, including making multiple different outputs using the same data (whether using different formats or different choices from the source data).
Also, if you have some facility with HTML it can be useful sometimes to make an HTML (or XML, markdown, etc.) page that looks like the desired result to help you figure what source info you need and where it needs to go in the template.