Telerik Forums
Reporting Forum
3 answers
205 views
When running a report, my line chart displays fine, but when exporting the chart to any format (PDF, Excel, ect...) the lines on the graph no longer show up.  The graph itself appears along with the key, x-axis information, y-axis information, but the actual lines are missing.

The chart is being built programmatic.

This code passes in a telerik chart, and the corresponding text file.

Private Sub LoadChart(ByVal sFileName As String, ByRef sChart As Telerik.Reporting.Chart)
       Dim inFile As StreamReader = File.OpenText(sFileName)
       Try
           Dim j As Integer
           Dim sLine As String
           Dim sValues() As String
           Dim chartSeries() As Telerik.Reporting.Charting.ChartSeries
           Dim bFirstLoad As Boolean = False
           Dim yMax, yMin As Double
 
           Do While inFile.Peek <> -1
               sLine = inFile.ReadLine
               sValues = Split(sLine, vbTab)
 
               If UCase(Trim(sValues(0))) = "TEMPERATURE" Then
                   'Create an array of Series for length of value
                   'Create Chart Series Names
                   For j = 0 To sValues.Length - 1
                       ReDim Preserve chartSeries(j)
                       chartSeries(j) = New Telerik.Reporting.Charting.ChartSeries
                       If j > 0 Then
                           If sValues(j) <> "" Then
                               chartSeries(j).Name = sValues(j)
                               chartSeries(j).Type = Charting.ChartSeriesType.Line
                               chartSeries(j).Appearance.PointMark.Dimensions.Width = 1
                               chartSeries(j).Appearance.PointMark.Dimensions.Height = 1
                               chartSeries(j).Appearance.PointMark.FillStyle.MainColor = chartSeries(j).Appearance.LineSeriesAppearance.Color
                               chartSeries(j).Appearance.PointMark.Visible = True
                               chartSeries(j).DefaultLabelValue = ""
                               chartSeries(j).YAxisType = Charting.ChartYAxisType.Primary
                           End If
                       End If
                   Next
               ElseIf IsNumeric(sValues(0)) Then
                   For j = 0 To sValues.Length - 1
                       If sValues(j) <> "" Then
                           If j > 0 Then
                               If bFirstLoad = False Then
                                   If yMax = 0 Then
                                       yMax = CDbl(sValues(j))
                                   End If
                                   If yMin = 0 Then
                                       yMin = CDbl(sValues(j))
                                   End If
                                   bFirstLoad = True
                               End If
 
                               'Add the values to the chart series
                               chartSeries(j).AddItem(CDbl(sValues(j)))
 
                               chartSeries(j).Item(chartSeries(j).Items.Count - 1).XValue = CDbl(sValues(0))
                               chartSeries(j).Item(chartSeries(j).Items.Count - 1).YValue = CDbl(sValues(j))
 
                               chartSeries(j).Item(chartSeries(j).Items.Count - 1).ActiveRegion.Tooltip = CDbl(sValues(j))
 
                               'Update Min and Max Values
                               If yMin > CDbl(sValues(j)) Then
                                   yMin = CDbl(sValues(j))
                               End If
 
                               If yMax < CDbl(sValues(j)) Then
                                   yMax = CDbl(sValues(j))
                               End If
                           End If
                       End If
                   Next
               End If
           Loop
 
           For j = 0 To chartSeries.Length - 1
               If j > 0 Then
                   sChart.Series.Add(chartSeries(j))
               End If
           Next
 
           sChart.PlotArea.XAxis.AxisLabel.TextBlock.Text = "Temperature"
           sChart.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = Color.Black
           sChart.PlotArea.XAxis.Appearance.Visible = Charting.Styles.ChartAxisVisibility.True
           sChart.PlotArea.XAxis.VisibleValues = Charting.Styles.ChartAxisVisibleValues.All
           sChart.PlotArea.XAxis.Appearance.Width = 3
           sChart.PlotArea.XAxis.MinValue = 10
           sChart.PlotArea.XAxis.MaxValue = 100
           sChart.PlotArea.XAxis.LabelStep = 10
           sChart.PlotArea.XAxis.MaxItemsCount = 100 + 1
           sChart.PlotArea.XAxis.AutoScale = False
 
 
           sChart.PlotArea.YAxis.AxisLabel.TextBlock.Text = "Concentration"
           sChart.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = Color.Black
           sChart.PlotArea.YAxis.Appearance.Visible = Charting.Styles.ChartAxisVisibility.True
           sChart.PlotArea.YAxis.Appearance.Width = 3
           sChart.PlotArea.YAxis.IsZeroBased = False
           sChart.PlotArea.YAxis.VisibleValues = Charting.Styles.ChartAxisVisibleValues.All
           sChart.PlotArea.YAxis.MaxValue = yMax
           sChart.PlotArea.YAxis.MinValue = yMin
           sChart.PlotArea.YAxis.AutoScale = False
 
           sChart.ChartTitle.TextBlock.Text = "Concentration vs Temperature"
 
       Catch ex As Exception
           VOMsgBox(ex.ToString)
 
       Finally
           inFile.Close()
           inFile = Nothing
       End Try
   End Sub

Any Idea on why it doesn't display when exported?

Thanks,
-Scott Cline
Scott
Top achievements
Rank 2
 answered on 22 Sep 2010
1 answer
405 views
hello

i want to set the documentname as default name for download depending on the data i pass to the report.

i tried the following methods but without success:
1. to use a parameter in the constructor (not possible because in the constructor the parameters are not initalized),
2. use the datasource and a property of datasource(also not possible)
3. use a constructor with string parameter but the emtpy constructor is called afterwards and the documentname is still ""
4. set the documentname in prerender or pageload with a public method

how can i set the document name to a variable so the default download name appears correctly?

Steve
Telerik team
 answered on 22 Sep 2010
1 answer
137 views
I am using parameter report but when I am trying to access the report it throwing me following error
I am also passing parameter

   public FinancialAccountHistoryReport()
        {
            InitializeComponent();
            this.FinancialAccountHistoryReportViewer.RenderBegin += new RenderBeginEventHandler(FinancialAccountHistoryReportViewer_RenderBegin);
        }

        private void FinancialAccountHistoryReportViewer_RenderBegin(object sender, Telerik.ReportViewer.Silverlight.RenderBeginEventArgs args)
        {
            //single value parameter
            args.ParameterValues["SelectFiscalYear"] = "2010"; //single value parameter
            args.ParameterValues["SelectFiscalPeriod"] = "3";
        }

Please check attachment for error.
Steve
Telerik team
 answered on 22 Sep 2010
2 answers
155 views
I have searched through Telerik KB, Forums etc. and also Google. Yes, it is about the infamous "Operation could not be completed" error.

Most of the threads about the issue includes formatetc error too but in my case it is not true. I am just getting an "Operation could not be completed" error.

Here is the scenario:
  • Windows Vista with all updates
  • VS 2008
  • Telerik RadControls for ASP .NET AJAX Q3 2009 .Net 3.5
I have completed a web project within this environment. But I needed a reporting tool so I installed Telerik Reporting Q1 2009. I have developed a Class Library and tested my newly created reports. Everything was fine until I tried to add a ReporView into one of my web pages. I got "the" error.

To solve the problem (as suggested):
  • Re-Install Telerik Reporting
  • Reset Tool Box
  • Clean Asp .Net Cache
  • Restart VS/Computer
  • Add a couple of lines to web.config

Still the same.

Please, can anyone suggest something?
Kadir Kilicoglu
Top achievements
Rank 1
 answered on 22 Sep 2010
1 answer
301 views
I have a report with two charts on it.  The report has a particular datasource and the charts have a different datasource, but both charts use the same.  The Stored Procedure for the charts is called twice - once for each chart.  I was hoping to prevent this behavior.  Is there anyway to bind the 2nd charts datasource to the first chart?  I found this article:

http://www.telerik.com/community/forums/reporting/telerik-reporting/set-datasource-of-table-same-as-report-data-source.aspx

Which talks about sharing the Report's datasource.  I have not been able to figure out how to get two child objects (the charts) to share a datasource.  Any ideas out there?  Any tips greatly appreciated.

Thanks,

Sam
Peter
Telerik team
 answered on 22 Sep 2010
1 answer
355 views
Hi!  I've implemented a telerik report within a website.  The data for the report is being generated through a stored procedure in a MS SQL Server database which takes one parameter.  I have an aspx page with a Report Viewer control.  The dataset creation and databinding occurs in the code behind for the aspx page with the Report Viewer.  On another aspx page there is a button which loads the page with the Report Viewer.

The report loads without error and the data is present.  However the first time the report loads it takes several seconds before being displayed.  Any report displayed after that loads in less than a second.  Note - The value of the parameter for the stored procedure changes depending on what item the user decides to "view" so the data in the report varies depending on which item is selected.

Is there any way to speed up the initial loading of the report?

Thanks!
Steve
Telerik team
 answered on 22 Sep 2010
1 answer
85 views
version: Telerik_Reporting_Q2_2010_v4_1_10_714_dev.msi

I have a master report that links to a subreport similarly to what is done in the video: http://tv.telerik.com/watch/reporting/video/telerik-trainer-reporting-subreports

=======================================================
MasterReport

BlahID: {Fields.BlahId}
     ------------------------
     Subreport:

     Parameter Name   Parameter Value
     BlahId           =Fields.BlahId
=======================================================

=======================================================
Subreport

Report Parameters
   Members:
        BlahId Integer

DataSource: odsBlahDetail (object data source)
    This object returns data from a table with a WHERE clause that contains:
    
            WHERE BlahId=@BlahId
=======================================================

When I create the report without the subreport, everything works fine.  I get:

BlahID: 18
BlahID: 23
BlahID: 45
...

When I add the subreport in I get no report.  I ran some debugging and SQL profiler an determined that what is happening, is Telerik Reporting is in an infinite loop calling the subreport with the BlahID of 18 (the first one).

From what I can tell, I've set up my report the same as the above video, but since you don't post the source code for these videos, I can't definitively determine if I have...
Steve
Telerik team
 answered on 22 Sep 2010
2 answers
54 views
Hi guys this is my first post in this forum, and i have some problem ,

I'm working on project that involve a lot of reports and connecting it by sqlDatasource is not very efficient when changing the connection
because i have to change the connection  for each report.

my question is their any efficient way to connect to a stored procedure in one connection string for all reports something like a dataset in the DAL or BL and how?...

thanks in advance  
sahem
Top achievements
Rank 1
 answered on 21 Sep 2010
2 answers
110 views
Are there plans to support additional math functions like those available in System.Math class without creating custom user functions or is there an easier way to utilize these math functions in the expression builder?

Thanks
MD
Top achievements
Rank 1
 answered on 21 Sep 2010
3 answers
492 views

Hello Telerik Team,

I am getting the error."An error has occured while processing textbox:The expression contains undefined
function call FormType()".

I have a report..where in i used a user function called "FormType".
My datasource  for teh report is sharepoint list.

I am passing a parameter to the user function in the code.My user functions retrieves three values(one each time based on the conditions)But when i select the user function..in the edit expression dialog box..
i am not writing any parameter inside the user function as i am not sure what to write there.

I have gone through http://www.telerik.com/support/kb/reporting/designing-reports/the-expression-contains-undefined-function-call-myuserfunction-error.aspx
and thought i might fall in 2nd cateogry..but unable to find a solution for that

Please help me.

Here is the code.

InitializeComponent();
            string strType;
            SPSite oSite = new SPSite("spsiteurl");
            SPWeb oWeb = oSite.OpenWeb();
            string[] parameters = { "10", "100", "1000" };

            Telerik.Reporting.ReportParameter param1 = new Telerik.Reporting.ReportParameter();
            param1.Name = "ItemID";
            param1.Type = Telerik.Reporting.ReportParameterType.Integer;
            param1.AllowBlank = false;
            param1.AllowNull = true;
            param1.Text = "ItemID";
            param1.Visible = true;
           

            this.ReportParameters.Add(param1);

            SPQuery qry = new SPQuery();
            SPList oList = oWeb.Lists["customlist"];
          

            string camlQuery = CreateCAMLQuery(parameters);

            qry.Query = camlQuery;

            SPListItemCollection listItemsCollection = oList.GetItems(qry);

            StringBuilder sb1 = new StringBuilder();
           
                  for (int i = 0; i < parameters.Length; i++)
                {
                    foreach (SPListItem item in listItemsCollection)
                    {
                        if (parameters[i] != "")
                        {
                            sb1 = new StringBuilder();
                            if (parameters[i] == item["ItemID"].ToString())
                            {
                                sb1.Append(parameters[i].ToString() + "-" + item["FormType"].ToString() + ",");
                                strType = FormType(sb1.ToString());
                                break;
                            }
                        }
                    }

                  
                  
                }
 DataTable listItemsTable = oList.GetItems(qry).GetDataTable();
            this.DataSource = listItemsTable;

  }

        private static string CreateCAMLQuery(string[] parameters)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < parameters.Length; i++)
            {
                if (i >= 2 && !sb.ToString().EndsWith(@"</Or>"))
                {
                    sb.Insert(0, "<Or>");
                    sb.Insert(sb.Length, "</Or>");
                }

                sb.Append("<Eq>");
                sb.Append("<FieldRef Name='ItemID'/>");
                sb.AppendFormat("<Value Type='Choice'>" + parameters[i] + "</Value>", i);
                sb.Append("</Eq>");

                if (i >= 2 && !sb.ToString().EndsWith(@"</Or>"))
                {
                    sb.Insert(0, "<Or>");
                    sb.Insert(sb.Length, "</Or>");
                }

            }

            sb.Insert(0, "<Where>");
            sb.Append("</Where>");

            return sb.ToString();
        }

 public static string FormType(string strFormType)
        {
         
           string[] FormTypeValues = strFormType.Split(",".ToCharArray());
           string[] values = FormTypeValues[0].Split("-".ToCharArray());
           string ItemId = values[0];
           string formT = values[1];
           switch (formT)
           {
               case "PM":

                   formT = "Parking";
                   strFormType = formT;
                   break;

               case "PCO":

                   formT = "Nonparking";
                   strFormType = formT;
                   break;
           }

           return strFormType;
        }

I appreciate your support
Thank you,

Smith 

smith spd
Top achievements
Rank 1
 answered on 21 Sep 2010
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?