Telerik Forums
Reporting Forum
3 answers
693 views
New to these specific reporting controls, and that "ah ah" moment just hasn't arrived. Creating the class for a report, generating the datasource, setting up the parameters makes sense but getting it to work with parameters in designer is eluding me. I want to pass in a "begin" and "end" date for the data I pull, so I've set up the parameters in the datasource as @dtstrDate and @dtendDate, with DbType as Date and the Value as "=Parameters.startDate.Value" and "= Parameters.endDate.Value" respectively.

The query:

SELECT        w.Firstname, w.Lastname, wf.Login, wf.Logout, DATEDIFF(hour, wf.Login, wf.Logout) AS Hours
FROM            Workers AS w INNER JOIN
                       Workflow AS wf ON wf.LoggedInWorkerid = w.ID
WHERE        (wf.Login >= @dtstrtDate) AND (wf.Logout <= @dtendDate)


I've tested it in SQL Server with

DECLARE @dtstrtDate AS DateTime
SET @dtstrtDate = '02/13/2012'
DECLARE @dtendDate AS DateTime
SET @dtendDate = '02/17/2012'
 
SELECT w.Firstname, w.Lastname, SUM(DATEDIFF(hour, wf.Login, wf.Logout)) AS Hours
FROM Workers AS w JOIN Workflow AS wf ON wf.LoggedInWorkerid = w.ID
WHERE wf.Login >= @dtstrtDate AND wf.Logout <= @dtendDate
GROUP BY w.Lastname, w.FirstName


... and it works just fine.

In the Configure DataSource Parameters
Name                   DbType                     Value
@dtstrtDate         Date                          =Parameters.startDate.Value
@dtendDate        Date                          =Parameters.endDate.Value

Design Time Parameters
Name                 Value
@dtstrtDate       =02/13/2012 (and I've tried putting these values in single quotes as well)
@dtendDate      =02/17/2012

I've tried setting the DbType to string, as well on the designer, setting the startDate and endDate members in the ReportParameter collection to DateTime and String, and even using the CDate function to wrap the Parameters.startDate.Value i.e = CDate(Parameters.startDate.Value)...When I try to execute the query in the designer I get "Conversion failed when converting date/and or time from character string." What am I doing incorrectly?


Elian
Telerik team
 answered on 02 Mar 2012
1 answer
173 views
I have been reading threads about setting a subreport's datasource.   I am confused about where to set it programmatically.  Some threads show it being set after the Master report InitialComponent() event.  Some threads show it via the subrpt_NeedDataSource or Subrpt_ItemDatabaBinding within the parent report class file.  Others show it being set in the Subreport's class file in its NeedDataSource or Item Databinding event.

Could someone please tell me where to set the subreport datasource?

Elian
Telerik team
 answered on 02 Mar 2012
1 answer
294 views
hi

been wondering if i can use a dictionary of the format dictionary<string,list<sqlToLinqClass>> as the datasource id so how can i retrive the values from the list.. or there is a better method..

Regards
Saneesh
Elian
Telerik team
 answered on 02 Mar 2012
7 answers
539 views
Dear All ,
Hi
I want to Show More Then One Records Details In Single Report Viewer?
Like this way

Record 1                                                                                Record 2
ASHOK ENTERPRISE   ASHOK ENTERPRISE  
  DATE : 12/1/2011   DATE : 12/1/2011
ANAN BUILDERS   ANAN BUILDERS  
       
PAYMENT IS DUE AS PER UNDERMENTIONED PAYMENT IS DUE AS PER UNDERMENTIONED
BILLS, SO PLEASE MAKE THE PAYMENT SOON. BILLS, SO PLEASE MAKE THE PAYMENT SOON.
       
BILL NO. DATE AMOUNT Rs. BILL NO. DATE AMOUNT Rs.
       
150 6/30/2011 5000 150 6/30/2011 5000
175 7/31/2011 5500 175 7/31/2011 5500
200 8/31/2011 5500 200 8/31/2011 5500
225 9/30/2011 5000 225 9/30/2011 5000
250 10/31/2011 5500 250 10/31/2011 5500
300 11/30/2011 5000 300 11/30/2011 5000
       
  TOTAL RS. 31500   TOTAL RS. 31500

Thanks in advanse..
Elian
Telerik team
 answered on 02 Mar 2012
2 answers
136 views
hi i create dynamic report from the follwing code
all fine the pbm is when i export the report got problem
when i export report to xls the header is totally black
if i export the reportt to csv the alignment and header is repeated
if i export to pdf the header background color missing

If HttpContext.Current.Session("DynamicReportDatas") IsNot Nothing Then
 
           Dim datas As DataTable = HttpContext.Current.Session("DynamicReportDatas")
           Me.Table1.DataSource = datas
 
           Dim textboxGroup As Telerik.Reporting.HtmlTextBox
           Dim textBoxTable As Telerik.Reporting.HtmlTextBox
           Table1.ColumnGroups.Clear()
           Table1.Body.Columns.Clear()
           Table1.Body.Rows.Clear()
           Dim ColCount As Integer = datas.Columns.Count
           For i As Integer = 0 To ColCount - 1
 
 
               Dim tableGroupColumn As New Telerik.Reporting.TableGroup()
               Table1.ColumnGroups.Add(tableGroupColumn)
               'table1.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(Unit.Inch(1)));
 
               textboxGroup = New Telerik.Reporting.HtmlTextBox()
               'textboxGroup.Style.BorderColor.[Default] = Color.Black
               'textboxGroup.Style.BorderStyle.[Default] = BorderType.Solid
               textboxGroup.Value = datas.Columns(i).ColumnName
               textboxGroup.Size = New SizeU(Unit.Inch(1.4), Unit.Inch(0.2))
               textboxGroup.Style.BackgroundColor = Color.FromName("#79A7E3")
               textboxGroup.Style.Font.Bold = True
               textboxGroup.Style.Font.Size = New Unit(10)
               textboxGroup.Style.VerticalAlign = VerticalAlign.Middle
               textboxGroup.Style.TextAlign = HorizontalAlign.Left
               tableGroupColumn.ReportItem = textboxGroup
 
               textBoxTable = New Telerik.Reporting.HtmlTextBox()
               'textBoxTable.Style.BorderColor.Default = Color.Black;
               'textBoxTable.Style.BorderStyle.Default = BorderType.Solid;
               textBoxTable.Value = "=Fields.[" + datas.Columns(i).ColumnName & "]"
               textBoxTable.Size = New SizeU(Unit.Inch(1.4), Unit.Inch(0.3))
               textBoxTable.Style.VerticalAlign = VerticalAlign.Middle
               textBoxTable.Style.TextAlign = HorizontalAlign.Left
 
              
 
               Table1.Body.SetCellContent(0, i, textBoxTable)
               
 
               Table1.Items.AddRange(New ReportItemBase() {textBoxTable, textboxGroup})
           Next
 
 
       End If


is there any way to create dynamic reports
cs the column name and table name is dynamic and the column count is dynamic


IvanY
Telerik team
 answered on 02 Mar 2012
3 answers
401 views

Hello everyone,
I have to create a report with in total 4 nested tables. We'll do the example with only 2 tables for easier comprehension. 
Assume we have an array with Orders, and in this table is an array with Products. So for each Order we have several Products. 

I made a TelerikTable which is bound on the Orders. The first line is the table headers. Each Order has 3 lines:
- 1: specific information about the Order (id Order, ...)
- 2: A merged line with another table in it, bound on the Products array.
- 3: The total of all Products of that Order.
For better / clear comprehension, look at the NestedTable.jpg (attached file).

Let’s export that list in PDF format:
Now the problem is that some Orders have a lot of Products: for example 200 Products. An order doesn't necessarily begin at the beginning of the A4 page (it can be in the middle). So the array of Products of the second Order doesn’t fit on the first page, and it makes automatically a page break (because its 1 merged line of the main table?).

For better / clear comprehension, look at the ProblemNestedTable.jpg (attached file).

KeepTogether parameter is everywhere to false.

I don’t want that page break, but fragment the nested table (Products).

Is there a way that there is a “Keep Table Line Together = False”? Or I may be completely wrong with my table structure? Maybe there is another option instead of nested tables?

Thanks a lot :)

Raphael
Elian
Telerik team
 answered on 02 Mar 2012
1 answer
133 views
Hi,

I created a line chart in my report. Using the Wizard, I set the skin to Deep Green. Then based on the website documentation, I went to the Properties of the Chart to create ChartAxisItems for my X-Axis. I changed the Text value to "00:00" etc. In the Designer mode, all the axis item labels showed as expected. However when I switch to Preview mode, I still see my X-Axis items labelled as 0, 1, 2, 3 etc... I have tried compiling again, but din make a difference. Hope you can advise me on what I have not done or have done wrongly. Thank you for your time.
Elian
Telerik team
 answered on 02 Mar 2012
5 answers
184 views
Hi,

1. How do I set ChartSeriesItem.Label.Appearance.Visible = false
after binding a stackedbar-chart's datasource to a DataTable in the NeedDataSource method?

2. If this cannot be accomplished, I assume I would have to build the ChartSeries programmatically.  Can you direct me to code specifically geared towards programmatically building stackedbar charts? (The goal is an X-Axis with a date-label and stacked values representing different count-values. The legend should be the DataTable column-names.) 

The DataTable looks like this (the column-names are actually error-numbers from an external system):

MDate     10230     13456     23432
2011-01       4         1         1
2011-02       0         2         2
2011-03       2         0         0

The chart should look like this:
6|-G--|
5|----|  |----|           ¤ 10230(red)
4| B  |  | G  |           ¤ 13456(blue)
3|----|  |----|           ¤ 23432(green)
2| R  |  | B  |  |----|
1|____|__|____|__|__R_|_____
  2011    2011    2011
   -01     -02     -03

Hope you understand my question. The chart works fine with databinding but I would really like to take away the text on the bars and just leave the color with a legend instead.

Thanks for any assistance you can offer.
Elian
Telerik team
 answered on 02 Mar 2012
1 answer
185 views
I have a report in which I want to use a different sub-report for each detail item depending on a value in the item data. For example:

If type=1, Use sub-report Sub1
If type=2, Use sub-report Sub2
etc.

Is this possible? If so, how? I've tried putting a SubReport in the detail, and in the detail_ItemDataBound set the SubReport.ReportSource, but it doesn't seem to work. Any ideas gratefully received.

Thanks

Ross Crawford
Lucania
Top achievements
Rank 1
 answered on 02 Mar 2012
7 answers
294 views
My report was working fine using a SqlDataSource that used a SELECT without any WHERE clause.  Then I changed it to use an ObjectDataSource method that uses parameters to generate a WHERE clause, and my report now fails.  The ObjectDataSource method works fine when invoked by my WebForms, and I tried putting a breakpoint in my business object's Select method, and I never got there, so I'm pretty sure it's not a problem within my object.

When I try to "preview" the report, the designer shows me this error message:
    An error has occurred while processing Report 'MyReport':
    Exception has been thrown by the target of an invocation.
    --------------------- InnerException ----------------------
    Object reference not set to an instance of an object.

I based my implementation upon this tutorial: http://tv.telerik.com/watch/reporting/objectdatasource/using-parameters-with-objectdatasource-component

I'm a Reporting newbie, and I need to learn how to debug reports.  (Apparently you can't simply step through them using the debugger.)  So any tips on how to investigate report bugs would be gratefully accepted.
Steve
Telerik team
 answered on 01 Mar 2012
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?