Telerik Forums
Reporting Forum
1 answer
106 views
Hi,
We have a business requirement where we will have different views for printing and report viewer (web). We're planning to create seperate reports for both views with different names (example : name of the report for the web will be 'ReportWeb' and for print will be 'ReportPrint'. How to call the the report for print when the user clicks the Print button? Or is there any better way to achieve this?

Regards,
Majar
Todor
Telerik team
 answered on 22 Apr 2019
2 answers
1.5K+ views

Hi, I'm very new to Telerik Reporting so please excuse the very basic question :)

I have a solution with multiple projects. The reports are in their own project.  I am trying to create the report from the website project and send a list of my data type to the objectDataSource of the report so that it can dynamically populate the report table. Then I render the report instance as a pdf to store. 

I am able to call and create the report, but I am having trouble getting the report to populate any data into the table.  The report renders but is blank other than the table headers. 

I am trying to find an example solution that does this using 2 projects, a telerik report, an object data source, and a GetData method that takes in a List<MyData> and returns the List<StuffData> so that the table can be populated. Is this doable or is there a better way to pass a list of data to the report so that it can dynamically populate the table on the report? 

Telerik.Reporting.ObjectDataSource objectDataSource1 = new Telerik.Reporting.ObjectDataSource();
        List<StuffData> stuffDataList = new List<StuffData>();

//This is just an example. The list will be populated from user selections adding to the list. 
        for (int i = 1; i < 3; i++)
        {
            int dummyNumber = 999999999 - i;
            StuffData stuffData = new StuffData()
            {
                stuffAddress = i + "Main Street",
                stuffDataId = i,
                stuffSource = "Source " + i,
                stuffName = "Big Corp #" + i,
                stuffNumber = dummyNumber.ToString()
            };
            stuffDataList.Add(stuffData );
        }

//Class in the report project that contains the GetStuffData method to return the list of stuff.  I couldn't find a way to pass a List<StuffData> in as a report 

//parameter

        objectDataSource1.DataSource = typeof(StuffDataAccess);
        objectDataSource1.DataMember = "GetStuffData";
        objectDataSource1.Parameters.Add(new Telerik.Reporting.ObjectDataSourceParameter("stuffDataList", typeof(List<StuffData>), stuffDataList));

        ReportTemplate.StuffReviewReport stuffReviewReport =
    new ScheduledHearingTemplate.StuffReviewReport();
        stuffReviewReport.DataSource = objectDataSource1;

        ReportProcessor reportProcessor = new ReportProcessor();
        Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
        instanceReportSource.ReportDocument = stuffReviewReport;
        RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);
       

Thanks in advance. 

T
Top achievements
Rank 1
 answered on 22 Apr 2019
2 answers
133 views

I see "Using Multivalue Parameters" document that "The data source cannot be a stored procedure. Telerik Reporting does not support passing a multivalue parameter array to a stored procedure."

I want to confirm if I can pass MultiVaule to Oracle stored procedure in standalone version. 

Many thanks

 

Nasko
Telerik team
 answered on 19 Apr 2019
2 answers
169 views

I am new to Telerik and have run into an issue with the creation of a Pie chart.  I first set my data source groups and run the design mode view to see that the graph looks correct.  I then go to start cleaning things up and rename the graph from graph1 to another name and then run the designer view again to see the error :

An error has occurred while processing Graph 'DeviceTypePercentages':

An error has occurred while processing RangePolarDataPoint:

Scope name 'graph1' does not represent a valid data scope name.

---------InnerException--------

Scope name 'graph1' does not represent a valid data scope name.

Thanks for any help you can provide on this.

James
Top achievements
Rank 1
Iron
 answered on 18 Apr 2019
2 answers
796 views

Hi there

I'm trying to change the image size of a report when saving it as PNG file. I'm using this code to render the report and save it as PNG file:

private static void RenderReport()
{
    ReportProcessor reportProcessor = new ReportProcessor();
    Hashtable info = new Hashtable();
    info["OutputFormat"] = "PNG";
 
    InstanceReportSource reportSource = new InstanceReportSource();
    reportSource.ReportDocument = new BucherLabel(nSalDocInternalNo, nSalDocItemInternalNo, nSalDocItemNo);
 
    reportProcessor.RenderReport("IMAGE", reportSource, info, CreateStream, out string docName);
    CloseStreams();
}
 
private static Stream CreateStream(string sFileName, string sExtension, Encoding encoding, string sMimeType)
{
    string sPath = $@"K:\Daten\SRM\FileOrder\{nSupplNo}\Labels\";
    sFileName = $"{nSalDocInternalNo},{nSalDocItemInternalNo}";
 
    if (!Directory.Exists(sPath))
        Directory.CreateDirectory(sPath);
 
    string sFilePath = Path.Combine(sPath, $"{sFileName}.{sExtension}");
    FileStream fs = new FileStream(sFilePath, FileMode.Create);
    lStreams.Add(fs);
 
    return fs;
}
 
private static void CloseStreams()
{
    foreach (Stream s in lStreams)
        s.Close();
 
    lStreams.Clear();
}

It works pretty fine. But I don't know how to set the filesize. Is this even possible?

Regards,
Roman

Roman
Top achievements
Rank 1
Iron
 answered on 18 Apr 2019
1 answer
476 views

Hi Team,

I am using Visual studio 2017 for designing Class Library Report (.cs) in my project.

And wanted to create template for Header and Footer, So I can use that in multiple Reports, but i couldn't find any solution in visual studio.

But it looks there is some option in Standalone designer tool that I am not using.

Please guide.

 

Thank you!

Prashant

Silviya
Telerik team
 answered on 18 Apr 2019
3 answers
280 views
I've a list in the telerik report which has a data source assigned in it's NeedDataSource event. The data source is a datatable, which has multiple rows. A checkbox is placed inside list and need to set the visibility of checkbox based on the database filed. Urgent!! Please help.
Silviya
Telerik team
 answered on 18 Apr 2019
2 answers
1.2K+ views

Hello, I have a string representation of the date - "01.02.2016", and I need to cast it to datetime with specific pattern "dd.MM.yyyy" to prevent wrong casting in another culture settings (e.g. en-us which will interpret it by pattern "MM.dd.yyyy").

How can I do this?

Thanks a lot!

ANDREY
Top achievements
Rank 1
 answered on 17 Apr 2019
4 answers
383 views
I want to be able to save report parameters the user has chosen and save them. Later the user can select the saved report and I'll run the report and fill in the (many) parameters at run-time. I came across this post written almost 2 years ago:

http://www.telerik.com/community/forums/reporting/telerik-reporting/saving-report-criteria.aspx#1736100

Does the Telerik Report Viewer expose an event or object which would allow me to grab these values? The only workaround I could see was to grab the data from the drop downs themselves. Using jQuery I wrote this as a simple test on a button click:

    $("iframe[id$='ParametersArea']").contents().find("select").each(function (index) {
        alert(  $(this).val() + " | disabled: " +  $(this).is(':disabled') + " | id: " + this.id);
    });

The only other option is to build my own Parameter sections from scratch (20 reports with up to 8 parameters each, oh joy).

Please let me know if anything has changed in the past to years in this regard,

Thank you
Marcel
Top achievements
Rank 1
 answered on 17 Apr 2019
1 answer
645 views

My report pulls 6 months, on the first to the last day for each month, of data from the past using a data picker and will use all 6 for one of the graphs, but I also want to use only the last full month of data for all of the rest of the graphs so I need to filter the 6 months to get that data.  I am trying to filter only the data for the last month using the date from the parameter but for this I will need the date parts because I want from the first day of the month to the last day of the month.  Can someone please give me an idea how I can do this?

ie.

Date Picker chooses 3/5/2019 meaning getting data for all days in each month of Oct, Nov, Dec, Jan, Feb, Mar

One report uses all 6 months

All other reports use only data from March

Any help would be greatly appreciated.

Neli
Telerik team
 answered on 16 Apr 2019
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?