Operator Scope of Action:
Operator First Added:
The operator exportedString() applies an export template to a note, returning the result as a String. The second template has 2 forms.
item designates the note to be exported; it is commonly "this". It is a note name, path or item designator. An attribute may not be used as a placeholder for such information. From v8.9.0, the exportedString() operator binds 'current' to 'this' note. Formerly, 'current 'was only bound in export templates. In short, this short improve the operator exporting the correct content.
templateFile is an HTML export template; this argument is evaluated allowing use of attribute values and expressions. Full template paths should not be quotes, but enclose template names ($Name) in double-quotes.
templateString is the name of an attribute holding a string of actual template code (i.e. what would normally be the contents of a template), which is then applied to the referenced note. The attribute reference cannot use a path extension to refer to a different note, $ExportCode is OK, $ExportCode(Another note) will fail.
The exportedString() operator is especially useful in conjunction with the runCommand() operator. You can use exportedString() to assemble the input an external program will require, and then pass that input to the external program.
If you simply wish to transform a string or attribute value (e.g. $Name) into a 'safe' value for use as an HTML/XML element 'id' value, use idEncode().
The first form of exportedString takes a reference to a note and the name of a template note and returns the result of applying the template to the note.
The second form requires as its second argument is the template string itself which may be literal code or an attribute reference.
$MyString = exportedString(this,^value($Name(parent))^);
$MyString = exportedString(this,$MyTemplate);