Hello - I want to import a JSON string from a file and use it as a data source in Smart Markes. The JSON file contains the following example:
{“name”:“Doe”, “age”:36, “car”:“None”}
First question - how can I import the JSON into memory - means a temporary structure and not into the opened excel workbook. The following code shows this for a workbook, but I do not want to change my workbook:
string jInput = File.ReadAllText(dataDir + “Test.json”);
JsonLayoutOptions jOptions = new JsonLayoutOptions();
jOptions.IgnoreArrayTitle = false;
jOptions.IgnoreObjectTitle = false;
jOptions.ArrayAsTable = true;
JsonUtility.ImportData(jInput, worksheet.Cells, 0, 0, JOptions);
-> What to use here for “worksheet.Cells, 0, 0” when I don’t want to change my excel.
Second question - I want to use the temporary structure from above (“worksheet.Cells, 0, 0”) as a data source for the smart markers. The following code shows how I set the data source, but not sure, what I have to use for “???”:
myReport.SetDataSource("???");
myReport.Process(true);
Third question - how should the Smart Marker look in excel. For the above example I thought I should use “&=name” is this right? And what do the types of Smart Markes from your documentation mean:
&=DataSource.FieldName
&=[Data Source].[Field Name]
&=$VariableName
&=$VariableArray
And the last question - how do I handle the following JSON strings:
{“name”:“Doe”, “age”:36, “car”:{“type”:“Honda”, “color”:“Blue”}}
[{“address”:“AGENT.OBJECTS.myInt32”,“description”:{“de”:“myInt32”,“en”:“myInt32”},“status”:0,“value”:2},{“address”:“AGENT.OBJECTS.myInt16”,“description”:{“de”:“myInt16”,“en”:“myInt16”},“status”:0,“value”:2},{“address”:“AGENT.OBJECTS.myInt16”,“description”:{“de”:“myInt16”,“en”:“myInt16”},“status”:0,“value”:3},{“address”:“AGENT.OBJECTS.myInt32”,“description”:{“de”:“myInt32”,“en”:“myInt32”},“status”:0,“value”:3}]
Thanks for your help.