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

1 answer
54 views

Dear Team,

 

We have to evaluate an old project which uses Telerik Reporting Version Q3.2020. The task is to migrate and update older asp.net and Windows forms reports to newer report version.

 

Can you please share the link to download the Trial version of Telerik Report Version Q3.2020?

Thank you,

Anup

Lance | Senior Manager Technical Support
Telerik team
 answered on 22 Sep 2023
1 answer
80 views

We have a custom report screen that uses multiple reporting frameworks to render reports as files (typically Excel). The available reports are loaded dynamically at runtime, the user picks a report which retrieves and displays the report parameters for the users to enter values, and then the report can be rendered to the file type that they choose.

We will be creating single reports (.trdp files) and report books (.trbp files) and uploading those onto the server for use with this screen. We are currently using the R1 2023 Reporting framework. Our application is written in c# and uses .NET Framework 4.8.

I have almost everything working with the Telerik framework but cannot find anywhere to create a ReportBook object from a .trbp file. The closest I found was this forum post (https://www.telerik.com/forums/reportbook-by-path-name)and this article on Deserializing from XML (https://docs.telerik.com/reporting/embedding-reports/program-the-report-definition/serialize-report-definition-in-xml). This does not work and I assume things have totally changed given the post was over 10 years old.

Using the code below gives the exception "Data at the root level is invalid. Line 1, position 1." The .trbp file that we are attempting to load was designed using the Telerik Standalone Report Designer.

var reportBook = new Telerik.Reporting.ReportBook();

using (System.IO.FileStream stream = new System.IO.FileStream(reportPath, System.IO.FileMode.Open))
{
    Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer = new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();                    
    reportBook = (Telerik.Reporting.ReportBook)xmlSerializer.Deserialize(stream);
}

Is it possible to load a .trbp file into a ReportBook object? If so, how?

Thanks,

Jason

2 answers
79 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
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

1 answer
710 views

Hi,

I have a problem when I  try to print report in controller. The thing is; it is working locally but when I deploy the project to iss I am getting error message says; "System.InvalidOperationException: No or invalid printer error on IIS server."


// Obtain the settings of the default printer
                System.Drawing.Printing.PrinterSettings printerSettings
                    = new System.Drawing.Printing.PrinterSettings();

                // The standard print controller comes with no UI
                System.Drawing.Printing.PrintController standardPrintController =
                    new System.Drawing.Printing.StandardPrintController();

                // Print the report using the custom print controller
                Telerik.Reporting.Processing.ReportProcessor reportProcessor
                    = new Telerik.Reporting.Processing.ReportProcessor();

                reportProcessor.PrintController = standardPrintController;

                    Telerik.Reporting.TypeReportSource typeReportSource =
                        new Telerik.Reporting.TypeReportSource();

                    //// reportName is the Assembly Qualified Name of the report
                    //typeReportSource.TypeName = reportName;

                // Create a new report source pointing to report definition
                var reportSource = new UriReportSource();
                reportSource.Uri = entity.ReportName;



                foreach (var i in entity.Parameters)
                {
                    reportSource.Parameters.Add(new Parameter(i.Key, i.Value));
                }


                    reportProcessor.PrintReport(reportSource, printerSettings);                    

                return null;

 

Please suggest,

Thanks

Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?