Hi all,
I have a report using the designer. I attached a JSON data source in the report, just for structure usage purposes:
{
"Data": [
{
"OrganizationId": "",
"OrganizationUuid": "",
"ParentOrgId": "",
"OrganizationName": " ",
"TotalUserCount": 0,
"TotalDeviceCount": 0,
"LicensedUserCount": 0,
"ExpirationDate": "",
"hasChildren": true
}
]
}When I try to inject the actual JSON data at runtime, the report is still generated with the sample data. Here's the lines generating the JsonDataSource:
var data = new ReportData { Data = result };
var ds = new JsonDataSource
{
Source = JsonConvert.SerializeObject(data),
DataSelector = "$.Data",
Name = "jsonDataSource1"
};
Then I assign the data source to the report:
using (var sourceStream = System.IO.File.OpenRead(_path + "\\Reports\\" + myRpt.ReportName))
{
var reportPackager = new ReportPackager();
report = (Report)reportPackager.UnpackageDocument(sourceStream);
var dtsrc = new ObjectDataSource();
dtsrc.DataSource = myRpt.GenerateReport(_parameters); // this is the JsonDataSource from above
dtsrc.Name = "jsonDataSource1";
report.DataSource = dtsrc;
}
When I render the report, the data is not injected, it just shows the single sample record from the designer. If I inject the actual JSON in the designer and do a preview, the report looks correct, so my guess is that I'm not doing this correctly. Any help would be greatly appreciated.
Regards