Telerik Forums
Reporting Forum
4 answers
238 views
Hi,

I set up a Telerik Reporting WCF Service, a silverlight client to show the report, created a report, succesfully added the WCF report service reference to the client, and verified that it is called. Everything works up to that part.

But how do I implement the methods of the IReportService interface? I can't find examples of what I'm supposed to do. Below is the code that I guessed so far from trial and error, but this gives a xaml error.

Is there an example of how to implement a WCF reporting service?
 
In specific the method: GetPage, what is the byte[]?The manual says "Gets or sets the Byte array that contains the current report page.", but is that in pdf format?

Regards,

Bayram

    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ReportService" in code, svc and config file together.
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class ReportService : IReportService
    {
        public void DoWork()
        {
        }
 
        private byte[] RenderToArray(string instanceID)
        {
            Telerik.Reporting.Processing.ReportProcessor reportProcessor =
                new Telerik.Reporting.Processing.ReportProcessor();
 
            //set any deviceInfo settings if necessary
            System.Collections.Hashtable deviceInfo =
                new System.Collections.Hashtable();
 
            Telerik.Reporting.InstanceReportSource instanceReportSource =
                new Telerik.Reporting.InstanceReportSource();
 
            instanceReportSource.ReportDocument = new PowerBrowser.Web.Modules.Reporting.ReportZakenDashboard();
 
            Telerik.Reporting.Processing.RenderingResult renderingResult =
                reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
 
            string fileName = renderingResult.DocumentName + "." + renderingResult.Extension;
            string path = System.IO.Path.GetTempPath();
            string filePath = System.IO.Path.Combine(path, fileName);
 
            byte[] result = new byte[renderingResult.DocumentBytes.Length];
            using (System.IO.MemoryStream fs = new System.IO.MemoryStream(result))
            {
                fs.Write(renderingResult.DocumentBytes, 0, renderingResult.DocumentBytes.Length);
            }
            return result;
        }
 
        public Telerik.Reporting.Service.PageInfo GetPage(string instanceID, int pageNumber)
        {
            PageInfo info = new PageInfo()
            {
                Buffer = RenderToArray(""),
                PageNumber = 1
            };
            return info;
        }
 
        public List<Parameter> GetReportParameters(string report, NameValueDictionary deviceInfo, NameValueDictionary parameters)
        {
            List<Parameter> reportParameters = new List<Parameter>();
            return reportParameters;
        }
 
        public IList<ReportInfo> ListAvailableReports()
        {
            ReportInfo info = new ReportInfo()
            {
                Description = "Mijn zaken",
                FullName = "Rapport - Mijn zaken",
                Name = "ReportZakenDashboard"
            };
            List<ReportInfo> reports = new List<ReportInfo>();
            reports.Add(info);
            return reports;
        }
 
        public IList<ExtensionInfo> ListRenderingExtensions()
        {
            List<ExtensionInfo> extensions = new List<ExtensionInfo>();
            ExtensionInfo info = new ExtensionInfo() { LocalizedName = "PDF", Name = "PDF" };
            extensions.Add(info);
            return extensions;
        }
 
        public RenderingResult Render(string format, string report, NameValueDictionary deviceInfo, NameValueDictionary parameters)
        {
            RenderingResult renderingResult = null;
            if (report == "ReportZakenDashboard")
            {
                renderingResult = new RenderingResult()
                {
                    DocumentBytes = new byte[] { },
                    DocumentName = "Test",
                    Extension = "PDF",
                };
            }
            return renderingResult;
        }
 
        public RenderingSessionInfo RenderAndCache(string format, string report, NameValueDictionary deviceInfo, NameValueDictionary parameters)
        {
            RenderingSessionInfo info = new RenderingSessionInfo()
            {
                PageCount = 1,
                DocumentName = "Mijn zaken",
                PageNumber = 1,
                Report = "ReportZakenDashboard"
            };
            return info;
        }
    }
Peter
Telerik team
 answered on 17 Dec 2012
1 answer
356 views
I tried to add an expression =PageNumber in the Report header, and it didn't show up.   

Shouldn't PageNumber be available in all sections?

I am using the reportheader to display [=Page #: 1] text instead of ="Page #: " + PageNumber.  Then with the reportheader hidden on other pages, I am using the pageheader to show the pagenumber text for each page with a smaller footprint.

Peter
Stef
Telerik team
 answered on 17 Dec 2012
0 answers
107 views
Hello,

I need to do pie chart to show life cycle of different Pallets.

In database have values like below:

Pallet Lifecycle UsedLifecycle RemainingLifecycle
P100 100 90 10
P101 200 100 100

Am able to display Pie chart individually for P100 Or P101.
But how to show 2 charts for P100 and P101 in single report?

I used Datagroupcolumn as PalletId; but the series shown in single chart itself, ie;P100 and P101 in same chart.
How to show it in different charts?

Its urgent.

Jayanthi
jayanthi
Top achievements
Rank 1
 asked on 17 Dec 2012
0 answers
88 views
I have a report that has a few toggle visibilty sections in it and in most cases the toggle button does not print or show in the preview, but for some reason the is one section that shows and prints the toggle button.  Is there a setting somewhere that needs to be set so that it does not print?
Eric Klein
Top achievements
Rank 1
 asked on 14 Dec 2012
11 answers
555 views
Hi,
We are using Telerik Reporting Q3 2007. 
 
- How can i load a saved report dynamically at run time?
- Is there any progress about save a report definition in outer storage (like xml-file) 
- When will your Report object (Telerik.Reporting.Report)  be supporting serializing / deserializing with soap or binary formatter or other way to serialize.
Steve
Telerik team
 answered on 13 Dec 2012
2 answers
331 views
Hello,

   I have a report and viewed in silverlight, my problem is how can I change the margin at runtime? Because the user has the option to change the margin anytime.

  Thank you.
YARARMAN
Top achievements
Rank 1
 answered on 13 Dec 2012
1 answer
352 views
I have a Table used to display an Address.  Not every user fills in every field and at diplay time i'd like to just remove the Rows that have no data.

I did this so far

var recipientContact = from ro in recipientOrg.AsEnumerable()
                        join rc in _db.RecipientContacts
                       on ro.RecipientOrganizationID equals rc.RecipientOrganizationID
                        select new
                          {
                              OrgName = rc.RecipientOrganization.Name,
                               ContactName = rc.FirstName + " " + rc.Surname,
                               Address1 = rc.Address1,
                               Address2 = rc.Address2,
                               City = rc.City.CityName,
                               Province = rc.Province.NameEnglish,
                               Country = rc.Country.CountryName,
                               PostalCode = rc.PostalCode,
                               Fax = ro.FaxNumber,
                               Phone = ro.PhoneNumber
                        };
                table5.DataSource = recipientContact.ToList();
 
        private void table5_ItemDataBound(object sender, EventArgs eventArgs)
        {
 
 
 
        }

This works fine, what I was thinking was that I could, in the databound event, loop through the Rows and see which, if any had no contents and jest Delete It?

Not sure where to start there though.
Steve
Telerik team
 answered on 13 Dec 2012
2 answers
273 views
Hi,

I have applied conditional formatting to controls. On a specific condition I am setting Visible=False for a textbox1. When this condition is true textbox1 gets invisible, but the textbox2 which is positioned just after textbox1 is shifted to left and takes the position of textbox1.

I gone through following link and found that this problem was in 2009 Q3 release. Is it still persist? I am using version 5.0.11.316 of Telerik Reporting.

Please suggest me some solution.
YARARMAN
Top achievements
Rank 1
 answered on 13 Dec 2012
1 answer
108 views
I have gone through http://www.telerik.com/help/reporting/entitydatasource.html but am completely stummped. My code generates no errors but all of the reports are coming up blank.

Here is my code:

XAML Element:
<telerik:ReportViewer Name="telerikPersonReport" Height="275" />


LoadTelericReport() is called after the data source and page has been initialized.
public void LoadTelericReport()
{
    Telerik.Reporting.EntityDataSource entityDataSource = new Telerik.Reporting.EntityDataSource();
 
    ReportEntity objectContext = new ReportEntity();
 
    entityDataSource.ObjectContext = objectContext;
    entityDataSource.ObjectContextMember = "Events";
 
    Telerik.Reporting.Report report = new Telerik.Reporting.Report();
    report.DataSource = entityDataSource;
 
    Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource();
    reportSource.ReportDocument = report;
 
    telerikPersonReport.ReportSource = reportSource;
    telerikPersonReport.RefreshReport();
}

The second part is the class that pulls from the Entity Framework:

public class ReportEntity
    {
 
        Attendance_Tracker ThisData = new Attendance_Tracker();
 
        public ReportEntity()
        {
            ThisData.Attendances.Load();
            ThisData.Attendees.Load();
            ThisData.Events.Load();
            ThisData.Sessions.Load();
        }
 
        public List<EventType> Events()
        {
            var AllEvents = from e in ThisData.Events.Local
                            select new EventType()
                            {
                                EventID = e.EventID,
                                EventName = e.EventName,
                                StartDate = e.StartDate,
                                EndDate = e.EndDate,
                                count = (from a in ThisData.Attendances.Local
                                         where a.Session.Event == e
                                         select a).Count()
                            };
            return AllEvents.ToList();
        }
}

Both sections are run fully, and AllEvents.ToList() is returning a full List<EventType> (if this matters it isn't called until after it has been bound to telericPersonReport.

As far as I can tell the WPF reporting front end just isn't displaying the List<EventType>, but it also isn't throwing an errors which seems strange. Is there something clearly wrong with my code, am I just completely off on how this works?

Thank you all for any directions you can point me in!
Siva
Top achievements
Rank 1
 answered on 12 Dec 2012
1 answer
797 views
hi 
bueno mi problema es que intento enviarle a un ReportViewer  algunos parametros por programacion y no me deja siempre sale igual
utilizo el siquiente codigo con el cual segun la documentacion estaria correcto pero  aun que no genera un  error tampoco trae la información
si alguien me puede ayudar  
 Dim Report As New Report1 

 Report.ReportParameters("idempresa").Value = "29"
        Report.ReportParameters("idsucursal").Value = "34"
        Report.ReportParameters("idfactura").Value = "12"
 ReportViewer1.RefreshReport()
Steve
Telerik team
 answered on 12 Dec 2012
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?