Telerik Forums
Reporting Forum
1 answer
391 views

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

Dimitar
Telerik team
 answered on 31 Oct 2022
1 answer
164 views

I am calling a JSON Webservice that does not return a nested object if the values are null.

I am using the value of the nested object (Fields.Orders.Salesperon.Name) in a detail row of my report.

This results in an error for any rows with no salesperson: "The expression containt object 'Name' that is not defined in the current context".

Here's a sample of what's being returned from the webservice:

{
  "Orders": [
    {
      "OrderNumber": 1,
      "Salesperson: { "Name": "Joe Example" }
    },
    {
      "OrderNumber": 2,
      "Salesperson: {}
    }
}

OrderNumber 1 will print fine. The row for OrderNumber 2 will have an error box.

Screenshot from the actual report:

 

How can I prevent this? I've tried null checks, value binding, conditional formatting... but it all throws an error because it's trying to access the nonexistent "Name" field on a record.

1 answer
327 views

Hi,

I have created a cross tab report with Snowflake ODBC as a data source and it works perfectly fine in Telerik Report Designer, when I click on preview I could see the data being fetched from my snowflake database.

I have snowflake DSN setup on my machine with name "SFDevAdmin"

But when I host it in .Net 5 as REST API and trying to render it in HTML I get connection error I think I need to specify the connection string in my asp.net application and I did it like this in my appsettings.json

 "connectionStrings": {
    "SFODBC": "Data Source=SFDevAdmin"
  }

but I am getting below error 

Could you please help me on this to make odbc connection work when hosted in asp.net 5 application 

0 answers
57 views

Hello,

I have a problem with handlig error msg.

The report is using WebServiceDataSource. When it returns  500 response - the pdf is generated with just a information with status code.

But there is other data delivered in response, with property logRef for example. I want to show this property on generated pdf.

How can I achive that ?

Thank you

Top users last month
Patrick
Top achievements
Rank 1
Iron
Iron
Iron
MIS
Top achievements
Rank 1
Ross
Top achievements
Rank 1
Marcin
Top achievements
Rank 1
Iron
Iron
Sean
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?