Hi,
I seem to be having an issue in my template using LINQ Reporting Engine when I am trying to surface elements from my JSON data source that have special characters in the name. Using quotes around it does the job fine for children elements eg. <<[Object.“qn_subjectMatter-Comment”]>> but for root elements it just prints out the text. Does anyone know a way around this? Thanks in advance
JSON DATA:
{
"qn_subjectMatter-Comment": "All of the above",
"qn_storedOnITNetworks": "Yes"
}
TEMPLATE SYNTAX:
<<["qn_subjectMatter-Comment"]>>
OUTPUT:
qn_subjectMatter-Comment
Cheers,
Sieryu Medaka
@Sieryu_Medaka
You are right. When a string literal (that is, “text-within-double-quotes”) is used after an object identifier, LINQ Reporting Engine is able to understand that it should be treated as the name of this object’s member rather than a string constant. However, a standalone string literal does not provide such a context, so it is always treated as a string constant by the engine. To recap, if using of special characters that require escaping within member names is a must, then these names should be preceded with names of corresponding objects and there is no other way to achieve this.
@Sieryu_Medaka
In addition to my previous comment, it is possible to assign an identifier for a root object that then can be used in templates for your case. Please check the ReportingEngine.BuildReport(Document, Object, String) overload. Its last parameter is the name of a data source.
1 Like
Hi Ivan,
Thanks for your reply…thought that might be the case
Cheers,
Sieryu
1 Like