Telerik Forums
Reporting Forum
1 answer
479 views
Hi! I have a problem, i would like to databind a PIE in a report, my code for binding a pie chart manually is like SAMPLE A, but i would like to assign YValue from a database, like the SAMPLE B, where i databind a bar chart from a database...

SAMPLE A
private void chart1_NeedDataSource(object sender, EventArgs e)  
        {  
            chart1.Width = Unit.Pixel(300);  
            chart1.Height = Unit.Pixel(300);  
            ChartSeries s = new ChartSeries();  
            s.Name = "NameOfSerie";  
            s.Type = ChartSeriesType.Pie;  
            for (int i = 1; i < 6; i++)  
            {  
                ChartSeriesItem item = new ChartSeriesItem();  
                item.YValue =i* 3.5;  
                item.Label.TextBlock.Text = "A" + i.ToString();  
                s.Items.Add(item);               
            }  
            s.Appearance.LegendDisplayMode =ChartSeriesLegendDisplayMode.Nothing;  
            chart1.Series.Add(s);  
        } 

SAMPLE B
private void chart1_NeedDataSource(object sender, EventArgs e)  
        {  
            string sql =  @"SELECT TOP 10 Production.Product.ListPrice, Production.Product.Name, Production.Product.ProductID FROM Production.Product";  
            string connectionString ="Data Source=localhost;Initial Catalog=AdventureWorks;Integrated Security=True";  
            SqlDataAdapter adapter = new SqlDataAdapter(sql, connectionString);  
            DataSet dataSet = new DataSet();  
            adapter.Fill(dataSet);  
            ChartSeries series = new ChartSeries();  
            series.DataYColumn = "ProductID";  
            series.DataLabelsColumn = "Name";  
            chart1.SeriesOrientation=ChartSeriesOrientation.Horizontal;  
            chart1.Width =Unit.Pixel(300);  
            chart1.Height = Unit.Pixel(300);  
            chart1.Series.Add(series);  
            (sender as Telerik.Reporting.Processing.Chart).DataSource = dataSet.Tables[0].DefaultView;   
        } 


I would like to fill a pie chart from a database, instead of a bucle...I mean...Something similar to SAMPLE B, where you can assign a DataYColumn, a field from the datasource...


Thanks for your time and i hope to find some help here...
Peter
Telerik team
 answered on 03 Mar 2010
2 answers
187 views
I know this issue has been addressed a few times, but I'm having issues still with my attempt. I'm trying to avoid using the wizard for my dataset and do everything programatically.

Here's what I have in the report code-behind:
Public Sub New()  
        InitializeComponent()  
         Try  
 
            Dim connMAS As SqlConnection = New SqlConnection()  
 
            Dim cmd As SqlCommand  
            Dim commLoadPortalUserInfo As SqlCommand = connMAS.CreateCommand()  
            connMAS.ConnectionString = Convert.ToString("some connection string")  
 
            connMAS.Open()  
            cmd = connMAS.CreateCommand()  
 
            cmd.CommandText = "storedprocedurename" 
            cmd.CommandType = CommandType.StoredProcedure  
 
            cmd.Parameters.Add("@CompanyID", SqlDbType.VarChar)  
            cmd.Parameters("@CompanyID").Value = Me.ReportParameters("CompanyID").Value  
 
            Dim da As SqlDataAdapter = New SqlDataAdapter(cmd)  
            Dim ds As DataSet = New DataSet  
 
            da.Fill(ds)  
            Me.DataSource = ds 
 
            connMAS.Close()  
              
        Catch ex As System.Exception              
            System.Diagnostics.Debug.WriteLine(ex.Message)  
        End Try  
    End Sub 
And here's what I have on my ASPX page calling the report:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
        If (Not Page.IsPostBack) Then  
            ReportViewer1.Report = New RosterReport()  
            ReportViewer1.Report.ReportParameters(0).Value = "Value" 
              
            ReportViewer1.RefreshReport()  
        End If  
 
    End Sub  
End Class 
And the parameter value never makes it to the report, so I get a blank one. If I execute the report and statically replace the Me.Parameter.Value with a static string value, everything works perfectly.

I've also tried many other variations of the code above and even tried creating a new instantce of my RosterReport and then binding it to the reportviewer to no avail.

Edit: It seems like the initial report is getting instantiated, but a version of the report with the parameter values assigned is never created. I thought that was the purpose of "refresh report"

Any help would be greatly appreciated.

John Cobb
Top achievements
Rank 1
 answered on 02 Mar 2010
4 answers
488 views

Hi,

I've been playing around with Telerik Report for just a couple days (basically reading the documentation and watching some videos) and have some questions. They are probable really basic questions, but since I didn't find so far an answer for them in the documentation nor by searching in the forum, I post them here.

I am trying to set a telerik report without having any DataBase conexion, so I thought on using a List (e.g. List<MyClass>) as DataSource.

How should I do this?

Until now, I added the DataSource programmatically, but then how do I connect the properties of the list elements (of type MyClass) with table/list/... cells?

Should I better define somehow the list as a project dataSource? how can I do this?

Does my approach make sense?

As I said at the beginning, I know these are probably beginner's questions, but I'm blocked!

Thanks!

Marta


Steve
Telerik team
 answered on 02 Mar 2010
2 answers
177 views
Hi again,

One of the issues we are interested in is a end-user report designer. I just red in the post Known limitations of Telerik Reporting that "End-user report designer is available at the moment", but I didn't found any positive reference to it in the documentation neither in other posts. Am I missreading? Otherwise, where can I find information about it?

Thanks,
Marta

Ps. By searching in the forum, I early realised that many people ask for this question in the past, hence I would have liked to skip old messages and just read the recent ones, but I couldn't identify the post date in the search results. Maybe it would be a good idea to add this details to them?
Peter
Telerik team
 answered on 02 Mar 2010
17 answers
1.2K+ views
I have a report that returns over 30,000 rows. The SQL query takes about 5 seconds to run but the report never ends up finishing.

I get a System.OutofMemory exception after almost 5 minutes of the report running. The report is using the WebForms viewer. There is not a lot of formatting on this report.

My question is is there a way to use paging (e.g. get records 100 - 200 at a time) to populate the report "on demand"?  Is there a way to get around this limitation? What is the limitation on number of records for Telerik reports?
Iurii
Top achievements
Rank 1
 answered on 01 Mar 2010
2 answers
219 views
Hi,

I know there's alot of post about setting the height of the reportviewer in a page. But i'm still having a problem.

First thing all my report are showing in a radwindow with a radtoolbar on top of it.
I've set all the parent of my reportviewer with height 100%. But there's still an overflow at bottom of the window that is the exact same height of the toolbar container.

Here is my code

<body> 
    <form id="form1" runat="server">  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
    </telerik:RadScriptManager> 
        <div id="TitleSection">  
            <fortress:PopupWindowToolbar ID="PopupWindowToolbar1" runat="server"></fortress:PopupWindowToolbar> 
        </div> 
        <div id="PageSection">  
            <div id="ContentSection">  
                <div id="ContentSectionContainer">  
                    <asp:ContentPlaceHolder ID="ContentPlaceHolderPopup" runat="server" > 
                    </asp:ContentPlaceHolder> 
                </div> 
            </div> 
        </div> 
    </form> 
</body> 
and my css :
html, body, form  
{  
    height:100%;  
}  
html  
{  
overflow:hidden;  
}  
 
#TitleSection  
{  
    positionstatic;  
    top:0px;  
    width:100%;  
    text-alignleft;  
    vertical-alignmiddle;  
    background#b6cef1 url(Header/GradiantEntete.png) repeat-x scroll bottombottom left;  
}  
 
#ContentSection  
{     
    position:relative;  
    top:0px;  
    left:0px;  
    width:100%;  
    height:100%;  
}  
 
.FortressReportViewer  
{  
    position:absolute;  
    top:0px;  
    left:0px;  
    rightright:0px;  
    bottombottom:0px;  
    height:100% !important;  
    width:100% !important;  
      
}  
 

FortressReportViewer is the class i applied directly on my reportviewer.
I've also tried switching doctype but it doesn't change any thing saddly. My reportviewer is still going below my radwindow borders.

Thx for your help,
Guillaume
Marius
Top achievements
Rank 1
 answered on 01 Mar 2010
2 answers
125 views
Hi

I'm using item.DataObject to get at the data in a report:
the data comes from SQL Server
and the column is named OptiClear

Code as follows:
==============
Private Sub detail_ItemDataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles detail.ItemDataBound
Dim item As Processing.ReportItemBase = DirectCast(sender, Processing.ReportItemBase)
Me.Total_OptiClear += DirectCast(item.DataObject("OptiClear"), Decimal)
===============

If the case of OptiClear is changed to Opticlear
ie A small c

The report previews fine in my windows project
but falls over in the Web Report Viewer

NOT A MAJOR PROBLEM
but it means that you have to make absolutely sure that the case of your item
is the same as the source column....

Any comments appreciated....

Regards

Martin Hoey






Martin
Top achievements
Rank 1
 answered on 01 Mar 2010
1 answer
336 views
Hi

I have created my own WCF service which uses the ReportProcessor to render an Xps to be used in the WPF DocumentViewer control. It worked fine when using the ReportProcessor directly from the App. But at soon as I move it to a service it fails.

I have created unit test that proves that the ReportProcessor works fine.

I get the following exception:
Test method Dako.ReportingService.UnitTest.DakoReportServiceTest.TestRenderXpsWithServiceHost threw exception:  System.ServiceModel.FaultException: FixedDocument must contain at least one FixedPage..

And when I look at the Debug trace I see another error:
----------------------------------------------------------------------------------------------------------------------------------
...

*** Measure Report (Vertical) STARTED ***
*** Measure Report (Vertical) DONE in 00:00:00.0008545 ***

*** Measure Report (Vertical) STARTED ***
*** Measure Report (Vertical) DONE in 00:00:00.0010941 ***

*** Measure Report (Vertical) DONE in 00:00:00.0055121 ***

*** ProcessReport #0 DONE in 00:00:00.3215597 ***

*** RenderReport #0 STARTED ***

*** RENDER PAGES STARTED ***
*** RENDER PAGES DONE in 00:00:00.0028726 ***

An error has occured while rendering the report: System.InvalidOperationException: The calling thread must be STA, because many UI components require this.
   at System.Windows.Input.InputManager..ctor()
   at System.Windows.Input.InputManager.GetCurrentInputManagerImpl()
   at System.Windows.Input.InputManager.get_Current()
   at System.Windows.Input.KeyboardNavigation..ctor()
   at System.Windows.FrameworkElement.FrameworkServices..ctor()
   at System.Windows.FrameworkElement.EnsureFrameworkServices()
   at System.Windows.FrameworkElement..ctor()
   at System.Windows.Controls.Panel..ctor()
   at System.Windows.Controls.Canvas..ctor()
   at Telerik.Reporting.XamlRendering.CompositionXamlBase.NewPhysicalPage()
   at Telerik.Reporting.XamlRendering.CompositionXps.NewPhysicalPage()
   at Telerik.Reporting.ImageRendering.CompositionBase.NextUsableArea()
   at Telerik.Reporting.ImageRendering.CompositionBase.NextHorizontalPage()
   at Telerik.Reporting.ImageRendering.ImageRendererBase.ProcessPages(CompositionBase composition, RenderingElement renderingReport, Int32 startPage, Int32 endPage, Boolean render)
   at Telerik.Reporting.ImageRendering.ImageRendererBase.ProcessPages(Report report, CompositionBase composition, Int32 startPage, Int32 endPage, Boolean render)
   at Telerik.Reporting.ImageRendering.ImageRendererBase.RenderReport(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback)
*** RenderReport #0 DONE in 00:00:00.0068132 ***

*** ReportProcessor.Render DONE in 00:00:00.3291403 ***

---------------------------------------------------------------------------------------------------------------------------------

I have another test that also calls the service which passes.

What am I doint wrong?

Best regards,
Michael
Michael Bendtsen
Top achievements
Rank 1
 answered on 01 Mar 2010
1 answer
269 views
When I export my report to Excel, how can I get the columns to 'Autofit'?
Peter
Telerik team
 answered on 26 Feb 2010
2 answers
382 views
In my report, I want to change the value of a textbox based on the value of the row data. I can't really use an expression because I may need to do a additional data lookup (depending on the data). Instead, I use the detail_ItemDataBound method to process the row data and change the text. At the same time (using the same method) I also change the visibility of another text box.

When I run the report, the visibility works fine, but the text is only changed on the row after the one being processed (the text for row n is displayed on row n+1). 

Is detail_ItemdataBound the right place to do this processing? Would detail_ItemDataBinding be better?

When do I use each one?

TIA.
Dave Hayward
Top achievements
Rank 1
 answered on 26 Feb 2010
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?