Telerik Forums
Reporting Forum
1 answer
76 views

A

10

 

 

 

20

 

 

A Total

30

AVG

0.25 (30/120)

B

20

 

 

 

30

 

 

 

40

 

 

B Total

90

AVG

0.75(90/120)

Total

120

 

 


Hello Sir,

I've a problem,
Above sample is a group like Report
The row of A Total and B Total are calculated(Sum) in TextBox control,
I want to use the row of  A Total and B Total to combine generate the value of AVG column automaticly as above sample.
How shoud I do ?
Pls help me,thanks :)

Regards.
Peter
Telerik team
 answered on 24 Sep 2010
3 answers
190 views
I am creating a schedule for games using the reporting and am unable to find solution for this.  i attempted keeptogether = false in the detailsection, but i get an invocation exception. 

i am building and populating tables dynamically and adding each to the detailsection.
issue is that i get up to 4 blank pages in between each new page with a table of game times on fields.
here is my man procedure to do so:

Public Sub BuildTable(ByRef t As Telerik.Reporting.Table, ByVal d As System.Data.DataTable, ByVal day As String, ByVal totaltables As Integer)

        t.Body.Rows.Add(New Telerik.Reporting.TableBodyRow(New Telerik.Reporting.Drawing.Unit(80, Telerik.Reporting.Drawing.UnitType.Pixel)))

        '
        'build report items for table
        '
        For Each c As System.Data.DataColumn In d.Columns
            c.ColumnName = c.ColumnName.Replace(" ", "_")
        Next

        For Each c As System.Data.DataColumn In d.Columns

            'we build the textbox for header
            Dim txtbox As New Telerik.Reporting.TextBox
            txtbox.Name = c.ColumnName
            txtbox.Size = New Telerik.Reporting.Drawing.SizeU(New Telerik.Reporting.Drawing.Unit(80, Telerik.Reporting.Drawing.UnitType.Pixel), New Telerik.Reporting.Drawing.Unit(50, Telerik.Reporting.Drawing.UnitType.Pixel))
            txtbox.Style.BackgroundColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
            txtbox.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid
            txtbox.Style.Font.Bold = True
            txtbox.Style.Padding.Bottom = New Telerik.Reporting.Drawing.Unit(5, Telerik.Reporting.Drawing.UnitType.Pixel)
            txtbox.Style.Padding.Left = New Telerik.Reporting.Drawing.Unit(10, Telerik.Reporting.Drawing.UnitType.Pixel)
            txtbox.Style.Padding.Top = New Telerik.Reporting.Drawing.Unit(5, Telerik.Reporting.Drawing.UnitType.Pixel)
            If c.ColumnName.Trim = "Start" Then
                txtbox.Value = day
            Else
                txtbox.Value = Replace(c.ColumnName, "_", " ")
            End If


            'we create value textbox
            Dim txtvalue As New Telerik.Reporting.TextBox
            txtvalue.Name = "Value" & d.Columns.IndexOf(c).ToString
            txtvalue.Size = New Telerik.Reporting.Drawing.SizeU(New Telerik.Reporting.Drawing.Unit(50, Telerik.Reporting.Drawing.UnitType.Pixel), New Telerik.Reporting.Drawing.Unit(50, UnitType.Pixel))
            txtvalue.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid
            txtvalue.Style.Padding.Left = New Telerik.Reporting.Drawing.Unit(5, Telerik.Reporting.Drawing.UnitType.Pixel)
            txtvalue.Style.Padding.Top = New Telerik.Reporting.Drawing.Unit(5, Telerik.Reporting.Drawing.UnitType.Pixel)
            If c.ColumnName.Trim = "Start" Then
                txtvalue.Value = "=thunder.apps.sa.reports.dal.reports.ConvertStartTime(Fields." & c.ColumnName & ")"

            Else
                txtvalue.Value = "=Fields." & c.ColumnName

            End If

            'we add new column
            t.Body.Columns.Add(New Telerik.Reporting.TableBodyColumn(New Telerik.Reporting.Drawing.Unit(90, Telerik.Reporting.Drawing.UnitType.Pixel)))

            t.Body.SetCellContent(0, d.Columns.IndexOf(c), txtvalue)



            'table group
            Dim tg As Telerik.Reporting.TableGroup = New Telerik.Reporting.TableGroup
            tg.ReportItem = txtbox
            tg.Name = "Group" & d.Columns.IndexOf(c).ToString

            t.ColumnGroups.Add(tg)
            t.Items.Add(txtvalue)
            t.Items.Add(txtbox)

        Next

        Dim tgroup As Telerik.Reporting.TableGroup = New Telerik.Reporting.TableGroup
        tgroup.Grouping.AddRange(New Telerik.Reporting.Data.Grouping() {New Telerik.Reporting.Data.Grouping("")})
        tgroup.Name = "DetailGroup"

        t.RowGroups.Add(tgroup)

        'additional table specs
        t.DataMember = ""
        t.DataSource = d

        Dim y As Integer = totaltables

        't.Items.AddRange(New Telerik.Reporting.ReportItemBase() {Me.TextBox8, Me.TextBox9, Me.TextBox10, Me.TextBox12, Me.TextBox14, Me.TextBox16, Me.TextBox18, Me.TextBox5, Me.TextBox11, Me.TextBox15, Me.TextBox13, Me.TextBox6, Me.TextBox7, Me.TextBox17, Me.TextBox19, Me.TextBox20})
        t.Location = New Telerik.Reporting.Drawing.PointU(New Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Inch), New Telerik.Reporting.Drawing.Unit(y, Telerik.Reporting.Drawing.UnitType.Pixel))
        t.Name = day.Replace("/", "")

        '  t.Size = New Telerik.Reporting.Drawing.SizeU(New Telerik.Reporting.Drawing.Unit(width, Telerik.Reporting.Drawing.UnitType.Pixel), New Telerik.Reporting.Drawing.Unit(height, Telerik.Reporting.Drawing.UnitType.Inch))
        ' t.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid
        t.KeepTogether = False
        t.Anchor = AnchorStyles.Left

    End Sub

Peter
Telerik team
 answered on 24 Sep 2010
3 answers
118 views
I've now spent a full day simply trying to get some data to my subreport.  I'm using the following code, which seems to do absolutely nothing.  What am I doing wrong??

Public Sub New()
    InitializeComponent()
End Sub
Private Sub admin_invoice_details_ownitnow_NeedDataSource(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.NeedDataSource
    Dim SQL As New StringBuilder
 
    SQL.AppendLine("       SELECT  ISNULL(products.itemid, 0) AS lotid,")
    SQL.AppendLine("                invdesc.itemdesc,")
    SQL.AppendLine("                invdesc.amount")
    SQL.AppendLine("        FROM    invdesc")
    SQL.AppendLine("                INNER JOIN products ON products.ProductID = invdesc.itemid")
    SQL.AppendLine("        WHERE   invdesc.invoiceid = @invoiceid")
 
    Dim sqlDataSource1 As New SqlDataSource()
    sqlDataSource1.ConnectionString = HttpContext.Current.Session("Conn")
    sqlDataSource1.SelectCommand = SQL.ToString
    sqlDataSource1.Parameters.Add("@invoiceid", DbType.Int32, "=Parameters.invoiceid")
    Me.DataSource = sqlDataSource1
End Sub
Steve
Telerik team
 answered on 24 Sep 2010
2 answers
70 views
1 answer
121 views
When playing around with Conditional Formatting for a TextBox in the reporting table I found a slight bug that caught me up.

Click the .. on Conditional Formatting

Conditional Formatting Rules window is displayed as shown in window1.jpg

Next click New Rule...

Edit Formatting Rule... Window is displayed as shown in window2.jpg

Click New add in a condition and click the style... button

Choose the Text option.

As shown in Window3.jpg

Change the font name to Tahoma, and color to Red, and click cancel.

Cancel button commits changes as if the user clicked Ok.

I got burned on this once as I didn't mean to change the condition but it changed.

Thanks,
-Scott Cline

Peter
Telerik team
 answered on 23 Sep 2010
1 answer
77 views
Hi!

I have a rendered report and I like to show this report now in full screen. (without rendering the Report again.)

My idea was to use the ChildWindow of the SL toolkit and replace the DataContext of the ReportViewer in the ChildWindow with the DataContext of my first ReportViewer.
Unfortunately it is not working. There is no error message, only the text "No Report".

Any ideas?
Thank you!


This is the Zoom Method that creates the ChildWindow, as a parameter I send the DataContext of my rendered report.
   
     private void Zoom(object param)
        {
            ReportChildWindow reportChildWindow = new ReportChildWindow(this.ReportViewer.DataContext);
            reportChildWindow.Show();
        }

In the code behind of the ChildWindow I set the DataContext
        public ReportChildWindow(object dataContext)
        {
            this.DataContext = dataContext;

            InitializeComponent();
        }

Peter
Telerik team
 answered on 23 Sep 2010
9 answers
799 views
I've created a "Dynamic" Table at run time based on a DataTable populated via code.  The DataTable is binding to the Table in the report in the ItemDataBinding Sub.

Private Sub tblSolution1_ItemDataBinding(ByVal sender As Object, ByVal e As System.EventArgs) Handles tblSolution1.ItemDataBinding
        Try
            Dim ds As New DataSet
            Dim dc As DataColumn
            Dim newDT As New DataTable
            'Changes datatable layout
            newDT = RestructureDataTable(MyDatatable)
            ds.Tables.Add(newDT)
            Dim processingTable As Telerik.Reporting.Processing.Table = sender
 
            Dim textboxGroup As Telerik.Reporting.TextBox
            Dim textBoxTable As Telerik.Reporting.TextBox
            Dim I As Integer
            I = 0
 
            tblSolution1.ColumnGroups.Clear()
            tblSolution1.Body.Columns.Clear()
            tblSolution1.Body.Rows.Clear()
 
            Dim tableGroupColumn As Telerik.Reporting.TableGroup
            Dim tableGroupRow As Telerik.Reporting.TableGroup
 
            For Each dc In ds.Tables(0).Columns
                tableGroupColumn = New Telerik.Reporting.TableGroup
                tblSolution1.Body.Columns.Add(New Telerik.Reporting.TableBodyColumn(Unit.Inch(0.5)))
 
                textboxGroup = New Telerik.Reporting.TextBox
                textboxGroup.Value = dc.ColumnName.ToString
                textboxGroup.Size = New SizeU(Unit.Inch(1.2), Unit.Inch(0.3))
                tableGroupColumn.ReportItem = textboxGroup
                tblSolution1.ColumnGroups.Add(tableGroupColumn)
 
                textBoxTable = New Telerik.Reporting.TextBox
                textBoxTable.Value = "=Fields." + dc.ColumnName
                textBoxTable.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid
                textBoxTable.Style.BorderWidth.Default = Unit.Pixel(1)
 
                tblSolution1.Body.SetCellContent(0, I, textBoxTable)
                I = I + 1
            Next
            tableGroupRow = New Telerik.Reporting.TableGroup
            tblSolution1.RowGroups.Add(tableGroupRow)
            tableGroupRow.Grouping.Add(New Telerik.Reporting.Data.Grouping)
            processingTable.DataSource = ds.Tables(0)
 
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub


I want to change the font and color of the text in the Table based on the value of the cell.  Such as if the value is less than 50 the text will be green above 50 text will be red. 

Please advise on how I might accomplish this?

Scott
Top achievements
Rank 2
 answered on 22 Sep 2010
3 answers
202 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
401 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
131 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
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?