Telerik Forums
Reporting Forum
2 answers
388 views

I'm working in a ASP.net core 3.1 web application. I want to display a Report without using the report viewer as well as not embedding the datasource into the report. The data for the report will be determined at runtime. So this is what I have done so far.

Defined a report with the report designer that has just one field                    = Fields.Title

The report does render with the correct number of lines that I expected. However there is no data.  The data object that gets assigned to the report datasource does have values.  Five values from the database.  It's just that the those values don't  bind to the ["Fields.Title] property of the report. All I see is 

Title
Title
Title
Title
Title

Here's the code

Controller Method that gets called from the GUI
 
 public FileContentResult GetTasksReports()
        {
            return File(_reportService.GetTaskReport(), "application/pdf");
        }
 
 
Service methods
 
 
public byte[] GetTaskReport()
{
          //get data from db. This returns data
           var tasks = _taskRepository.GetAllList();
 
            //Populate a List of Classes that will serve as the Reports datasource
            List<MyTasks> taskList = new List<MyTasks>();
            foreach (Task t in tasks)
            {
                MyTasks ts = new MyTasks()
                {
                    Title = t.Title
                };
                taskList.Add(ts);
            };          
 
            return getReport(taskList, "TasksNoEmbeddedDS.trdp");
        }
         
 private byte[] getReport(dynamic ds, string telerikReportName)
        {
            string reportName = "Reports\\Tasks\\" + telerikReportName;
 
            ReportPackager reportPackager = new ReportPackager();
            Telerik.Reporting.Report report = null;
            using (var sourceStream = System.IO.File.OpenRead(reportName))
            {
                 
                report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
 
                //assign the data to the Report Datasource
                report.DataSource = ds;
            }
 
            return RenderMyReport(report);
 }
 
        private byte[] RenderMyReport(Telerik.Reporting.Report report)
        {  
            System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
 
            InstanceReportSource instanceReportSource = new InstanceReportSource()
            {
                ReportDocument = report
            };
 
            var configuration = ConfigurationHelper.ResolveConfiguration(webHostEnvironment);
            ReportProcessor reportProcessor = new ReportProcessor(configuration);
            RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
 
            return result.DocumentBytes;
        }
 
 
 public class MyTasks
  {  
  public string Title;
 }      

 

 

 

Jeff
Top achievements
Rank 1
Veteran
 answered on 12 Oct 2020
1 answer
546 views

Hello!
I use HTML5Viewer with Telerik.Reporting.Trial and  I can't see XLS export options in viewer.

As far as I now XLS format not need third-party libraries (like OpenXML), but I installed this libraries too and add assembly redirect. It is not working.
Then I try add option programmatically in GetDocumentFormats() override method in my controller and I can see XLS option, but report return error "XLS rendering format is not available".
I readed article "Missing DOCX, XLSX, PPTX, XPS export options in viewers or "X rendering format is not available" error message", but this recommendations not help me.
Can you help me?
My JSON configuration for extention:

"extensions": [
  {
    "name": "XLS",
    "description": "XLS",
    "visible": "true"
  }
]
Neli
Telerik team
 answered on 12 Oct 2020
3 answers
422 views

Hi,

I have a report, where the user wants to be able to filter the data based on 2 parameters. Is it possible to make those parameters optional? The point is to be able to filter the results, but to be able to see them all as well.

Example: Let's say I have parameters Location and SalesmanId. I want to be able to filter by Location to show all the Salesmen and also to be able to set Location and SalesmanId to see only sales of the particular salesman in the location.
If I use in the SqlDataSource query condition WHERE, both parameters will be required, otherwise the query won't be valid. How to make the parameters optional? - that the query will show all salesmen in all locations, if none of the parameters is set.

Thank you in advance for your help.

Radovan

Todor
Telerik team
 answered on 09 Oct 2020
3 answers
791 views

Hello telerik team,

Can you help me with this, I need a reporting table to display (and group by name) some images, these images comes from my D.B and they are base64 strings, so I convert them to Image like this: Base64ToImage(myDBstring), this part works fine, but when i run it on my chsarp .net web project, the telerik reporting show me this error: 

An error as occurred while proccesing PictureBox 'picture1' Could not find part of the path C:\Myproyect\MyWebSite\System.Drawing.Bitmap.

 

See attached image (left is a single image box and right is the table with the error)

Note 1: I already did this with a single picture box succesfully, but now i need it in a table with two columns, Name and Image.

Note 2: I Dont use paths, i use D.B base64 images and merge them with a Dataset.

 

Silviya
Telerik team
 answered on 09 Oct 2020
2 answers
342 views

How can WPF ReportViewer display Multiple UriReportSources as one Report?

I want to diplay multiple UriReportSources (same trdp UriReportSource and same ParameterName, but varios ParameterValues) in WPF ReportViewer as one Report, wich contains this multiple UriReportSources successively.

Here is my C# Code:

ReportBook RB = new ReportBook();

UriReportSource uriRS = new UriReportSource();
uriRS.Uri = "MyYearTest.trdp";
uriRS.Parameters.Add(new Telerik.Reporting.Parameter("Year", 2018));

RB.ReportSources.Add(uriRS)

UriReportSource uriRS = new UriReportSource();
uriRS.Uri = "MyYearTest.trdp";
uriRS.Parameters.Add(new Telerik.Reporting.Parameter("Year", 2019));

RB.ReportSources.Add(uriRS)

UriReportSource uriRS = new UriReportSource();
uriRS.Uri = "MyYearTest.trdp";
uriRS.Parameters.Add(new Telerik.Reporting.Parameter("Year", 2020));
RB.ReportSources.Add(uriRS)

InstanceReportSource IRS = new InstanceReportSource();
IRS.ReportDocument = RB;
this.TRPViewer.ReportSource = IRS;

Both Objects (RB and IRS) contains 3 ReportSources.
But the WPF ReportViewer (this.TRPViewer) shows 3 times the same page, in fact 3 times the first Report of the Year 2018!

How can i display all 3 Years Reports (2018,2019,2020) as one Report in WPF ReportViewer?

Thom
Top achievements
Rank 1
 answered on 08 Oct 2020
1 answer
208 views

I am new to telerik report. I want to group data by name and address should show down to grouped property. Please find attached file that i generated from report. Please help how to get desired result that i attached.

Neli
Telerik team
 answered on 08 Oct 2020
1 answer
748 views

Is there any way of getting and editing web service datasource from report file(*.trdx, *.trdp) programmatically without using standalone Report Designer tool?

I know Report has DataSources property, but it's private. My scenario is: I generate OData query at runtime and I have to set that OData query string to the report WebServiceDataSource.ServiceUrl property value, or I have to change existed OData query and save that to data source. 

In this post suggested getting data sources through the data items(Table, List, Report parameters,...). But, for example I created data source and it's not assigned to any items yet. In this case how can I access to that data source? I still want to modify that data source which is not assigned.

Thanks,

 

Todor
Telerik team
 answered on 07 Oct 2020
3 answers
199 views

Hello everyone,

I have a question about the possibilities in the detail section:

we have multiple transports where each transport can have multiple kinds of goods and we would like to use the detail section to show both of them.

It should look like this (simplified) e.g.:


Truck A
                2 Pal. Lights
                1 Pal. Bananas
                20 Pal. Apples

Truck B
                4 Pal. Cups
                2 Pal. Gloves


…..

The problem is that in SQL we have no other possibility to join the tables so that the result looks like see att..

This will transform in multiple lines:

Truck A
                2 Pal. Lights
Truck A
                1 Pal. Bananas
Truck A
                20 Pal. Apples

Truck B
                4 Pal. Cups
Truck B
                2 Pal. Gloves

I also tried to use a table or a list Item but both would show all results for each entry.

Truck A
                2 Pal. Lights
                1 Pal. Bananas
                20 Pal. Apples
                4 Pal. Cups
                2 Pal. Gloves

Truck B
                2 Pal. Lights
                1 Pal. Bananas
                20 Pal. Apples
                4 Pal. Cups
                2 Pal. Gloves

Is there any possibility with another item, format, filter,group ..anything to get one row for each truck and with the goods for this one?

 

 


Neli
Telerik team
 answered on 07 Oct 2020
1 answer
415 views
I’m trying to pass in a list of integer IDs from within C# by setting a Telerik.Reporting.ReportParameter.Value.  I have tried a number of combinations of object types, from passing in a string of comma separated values to passing in an IEnumerable of Integers to no avail.  I have tried using the Array function on Designer side, but no matter what combination I try, I’m receiving an error that the value for WidgetIDList is invalid.  I was wondering what the object should look like that I set in the C# code, and what I should set the Value in the Telerik Report Designer for the parameter that will be passed to the stored procedure to generate results.  I’ve gone over the notes on the website over and over, and looked at a few articles on workarounds posted here, and still haven’t been able to determine a solution.  I would try to pass a string of comma separated values, but our UI relies on the AvailableValues to be set so that it can populate a dropdown list in our UI for the user to select from.  I'm wondering if that's what's causing the issue, the validation not liking what I'm passing. Thanks for your assistance.

Parameter being passed in
Name: WidgetIDList
AllowBlank: False
AllowNull: False
AvailableValues: dsGetAllWidgetNames [Telerik.Reporting.SqlDataSource] (This is a SQLDataSource that uses a connection string to call a stored procedure to populate the values.)
DataSource: dsGetAllWidgetNames [Telerik.Reporting.SqlDataSource]
DisplayMember: = Fields.WidgetName
Filters: (No Filters)
Sortings: (No sorting)
ValueMember: = Fields.WidgetID
Mergeable: True
MultiValue: True
Name: WidgetIDList
Text: Widget
Type: Integer
Value:
Visible: True

Parameter to be passed to Stored Procedure to generate results
@WidgetIDList: Telerik.Reporting.SqlDataSourceParameter
DBType: AnsiString
Name: @WidgetIDList
Value:
Neli
Telerik team
 answered on 05 Oct 2020
1 answer
147 views

Hi.

My report contains a table that is expected to not fit on a single page so it has KeepTogether set to false. It also has ColumnHeadersPrintOnEveryPage set to true. 

In print preview or when rendered as DOCX or PDF the table splits correctly, i.e. a blank row is drawn at the end of the first page indicating that the table continues on the next page. 

When rendered into PPTX however (which is the target format for me) the blank row gets drawn at the start of the next page instead. It would not be that much issue without table headers repeating on every page. With them it looks quite confusing.

Neli
Telerik team
 answered on 02 Oct 2020
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?