Telerik Forums
Reporting Forum
1 answer
26 views

I created a report using Telerik Report Designer Standalone with sqlDataSource1 setup with the following ReportParameters like this:



C# coded that read that send the parameter as Int32

    var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
    // set any deviceInfo settings if necessary
    var deviceInfo = new System.Collections.Hashtable();
    var reportSource = new Telerik.Reporting.UriReportSource();
    var directory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
    var value = Convert.ToInt32(numericExportarPdf.Value);
    reportSource.Uri = "Report.trdp";
    reportSource.Parameters.Add("NRO_TICKET", value);
    Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", reportSource, deviceInfo);
    if (result.HasErrors) return;
    string fileName = result.DocumentName + "." + result.Extension;
    string path = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
    string filePath = Path.Combine(path, fileName);
    using FileStream fs = new FileStream(filePath, FileMode.Create);
    fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);

I get the following error:

Telerik.Reporting.Processing.CancelProcessingException: An error has occurred while processing the report. Processing canceled. Check the InnerException for more information.
 ---> System.Exception: Invalid value of report parameter 'NRO_TICKET'.
   --- End of inner exception stack trace ---
   at Telerik.Reporting.Processing.Report.ValidateParameters()
   at Telerik.Reporting.Processing.Report.ProcessItem()
   at Telerik.Reporting.Processing.ReportItemBase.ProcessElement()
   at Telerik.Reporting.Processing.Report.ProcessElement()
   at Telerik.Reporting.Processing.ProcessingElement.Process(IDataMember dataContext)
   at Telerik.Reporting.Processing.Report.Process(Boolean processItemActions, Boolean documentMapEnabled)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessReport(Report report, IPathResolver pathResolver, IProcessingContext parentContext, IEnumerable`1 parameters, Key rootKey, Boolean interactivityEnabled, Boolean documentMapEnabled, PageLayoutInfo pageSettings, ErrorEventHandler errorHandler, List`1 documentNodes, Boolean& documentMapAvailable)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessResolvedReports(ResolvedReportDocument resolvedReportDocument, IList`1 parameters, IProcessingContext contextPerDocument, Boolean interactivityEnabled, Boolean documentMapEnabled, PageLayoutInfo pageSettings, List`1 processedReports, ErrorEventHandler errorHandler, List`1 documentNodes, Boolean& documentMapAvailable, ListSlice& tocReportsSlice)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessReportSource(ReportSource reportSource, IRenderingContext context)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessReportSource(ReportSource reportSource, Hashtable deviceInfo, IRenderingContext context)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRender(String format, ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRenderStateless(String format, ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback)
   at Telerik.Reporting.Processing.ReportProcessor.<>c__DisplayClass47_0.<RenderReport>b__0(SingleStreamManager sm)
   at Telerik.Reporting.Processing.ReportProcessor.RenderReportSafe(Func`2 renderCallback, String format, IRenderingContext renderingContext)
   at Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, ReportSource reportSource, Hashtable deviceInfo, CancellationToken cancellationToken)
   at Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, ReportSource reportSource, Hashtable deviceInfo)

If I remove the parameter the report works fine, I added changing to Decimal Type value as my DB engine is MS-SQL 2022 Express. I added filters and get same error. I don't know what to do anymore What I am missing

2 answers
80 views

Currently, I have two different parameters. One uses Fields.ID the other needs to use Field.ID2 However, using the code below. I am unable to rename ID to ID2. If I use ID It modifies Parameter1's ID field instead of Parameter2's ID field. I need to use dual union to be able to select all employees but when I run it with the "AS" command for renaming ID to ID2 it errors out(see below code). If I run it without the dual union. It works and renames ID to ID2. But, then I do not have the ability to select all employees which I need. How can I fix this in the report designer? is there a better way or am I using my code wrong, what would be a good solution to this?

 

How can I get this to work and rename ID to ID2 for the second source using the code below so that I can still use the dual union?

 

[Doesn't work]

SELECT TO_NCHAR('All Employees') AS FirstName, TO_NCHAR('*') AS LastName, 0 AS ID FROM DUAL
UNION
select FirstName, LastName, ID AS ID2

FROM Personnel
ORDER BY LastName NULLS FIRST

 

[Works]

select FirstName, LastName, ID AS ID2

FROM Personnel
ORDER BY LastName NULLS FIRST

 

 

Thank you!

0 answers
75 views

Hello,

I'm new to Telerik Reporting and hope you can point me in the right direction.

I'm working on a WPF application that will need to export a report to PDF. The user does not need to see the report directly prior to it being exported.

 

Currently I have a report file saved as a .trdp file, which I am able to export to PDF based of of existing examples.

Additionally, I've been able to add data to the report prior to printing successfully. I'm simply wondering if what I'm doing is the best way to accomplish my results.

 

I currently create a new UriReportSource and set the Uri to the local trdp file.

I think add parameters, one at a time to the reportSource...

reportSource.Parameters.Add(new Telerik.Reporting.Parameter("LogDate", "5/3/2022"));

 

Once the parameters have been added I use a report processor to render the report.

While this appears to work perfectly fine, I'm wondering if there's a more efficient method, such as passing a JSON string to a report.

If not that's fine and I'll make this work.

 

Any insight is appreciated.

 

Aaron
Top achievements
Rank 1
 asked on 03 May 2022
0 answers
66 views

How do I create a dropdown with the options of: greater than >, less than <, or equal to =, then have a textbox for the value?

See attached image for something similar I am looking for. I'm trying to make a report where the user can enter a number, then select one of the options I just described. I've been stuck on this for a week!!!

 

I've read so many articles, and watched 7-8 year outdated youtube videos. Any help is greatly appreciated!

 

-Chris

4 answers
462 views

Hi

I'm developing an WPF app that imports trdx file, serializes to a report object, set an ObjectDataSource and generate (using RenderReport method) to pptx file.

The trdx file contains a subreport with the same DataSource but different DataMember. The DataMember of the subreport get an input from the a report parameter (=Parameters.Param1.Value). The subreport parameter filled by the main report (Param1 =Fields.Id).

For example, for each order in the report, the subreport get its ID as parameter and returns all its order details.

In the generated report (pptx) I see all the reports data but the subreport data is empty. How should I set the DataSource, DataMember and Paramerters of the subreport correctly?

 

Thanks

Michal

 

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?