Telerik Forums
Reporting Forum
1 answer
43 views
Hi All,

Apologies for the simplistic title here!

I was just wondering conceptually whether from a rendering efficiency perspective, what is the best route for a report containing a relatively large amount of data between the following two options (Assuming a 1000 item dataset for the purposes of illustration):

A) 100 pages with 10 records per page
B) 10 pages with 100 records per page

I appreciate that the type of report may be a part of the answer, so for this example my report simply has 4-5 fields per record. The details section of the report simple has a header which lists the title of the record and 3-4 fields within the detail section to display the record details.

No images, calculations, charts, or anything else fancy are used, I simply wondered if anyone had any info on how the renderer 'should' respond to these two situations,

Many thanks,

Doug
Peter
Telerik team
 answered on 03 Aug 2011
1 answer
109 views
Hi.

Im making an invoice report and i want a summary of all projects on that invoice at the beginning of the repport ordered by project name.
You could call it a summary list of all projects. I only get the data from the latest project, not all of them. I tried with a table, list and cross table but i dont get out any data.

Underneath i got a group section with all projects, articles and workdates and this works perfectly.

Here is the code i use to set the datasource:

     var invoice = InvoiceRepository.GetInvoiceById(226);


            var query = from w in invoice.WorkHours
                        select new
                                   {
                                       Hours = w.BillableHours ?? w.Hours,
                                       Period = string.Format("{0:yyyy-MM-dd} - {1:yyyy-MM-dd}", w.Invoice.StartDate, w.Invoice.EndDate),
                                       WorkDate = w.WorkSpecification.WorkDate,
                                       Consultant = w.WorkSpecification.User.FirstName + " " + w.WorkSpecification.User.LastName,
                                       ClientName = w.WorkSpecification.Project.Client.ClientNameLegal,
                                       CompanyName = w.WorkSpecification.User.Company.CompanyName,
                                       ArticleName = w.Article.ArticleName,
                                       ProjectName = w.WorkSpecification.Project.ProjectName,
                                       InvoiceTag = w.Invoice.InvoiceTag,
                                       InvoiceUrl = w.Invoice.InvoiceURL,
                                       InvoiceNo = w.Invoice.InvoiceNo,
                                       PricePerHour = w.Article.Prices.Single(p => p.StartDate <= w.WorkSpecification.WorkDate && (p.EndDate ?? DateTime.MaxValue) >= w.WorkSpecification.WorkDate).PricePerHour,
                                       YourReference = w.WorkSpecification.Project.ClientContactName,
                                       ContryZipAndCity = string.Format("{0}-{1} {2}", w.WorkSpecification.User.Company.CountryCode, "", ""),
                                       OurReference = "",
                                       CompanyAdress = "1",
                                   };


            return query.ToList();

Please help me. Ive been working on this for 3 days and im quite a good developer but this thing just breaks me.

Best regards Stefan Ã…berg.
Peter
Telerik team
 answered on 03 Aug 2011
2 answers
94 views
In a Silverlight app I have a ListBox which is populated using the results of the ListAvailableReports service method(available from the report service).
The method's result is an IList<ReportInfo>.
The class ReportInfo has 3 properties:
Name - contains the report Class name in the Report Library,
FullName - contains the full assembly name,
and
Description.

Obviously I cannot use the firs two, for the user to identify the Report.
My question is: How do I populate the Description property? (What property do I need to set in the Report class on the server ?)
I've looked for some time, but i cannot find it.

Ty for your time,
Alex.

Edit: I use the Reporting 2011 Q2.
Alex
Top achievements
Rank 2
 answered on 03 Aug 2011
0 answers
129 views
Hi, I know there are already some people have discussed about this issue. However, I am getting this error intermittently and couldn't manage to reproduce the error. Can anyone point out what's wrong with the code? The ChartReport is created on the fly and inserted to the main report. It throws the 'Parameter is invalid' when trying to set the value of picture box. Thanks in advance.


public partial class ChartReport : Telerik.Reporting.Report
    {
        public ChartReport(ImageReport chart, string chartTitle, string reportName)
        {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //  
                using (MemoryStream ms = new MemoryStream(chart.Image))
                {
                    ms.Seek(0, SeekOrigin.Begin);
                    Image img = Image.FromStream(ms);
                    Image img2 = CopyImage(img);

                    pcb_Chart.Value = img2; //This line throws the Parameter is invalid error when the value of the picture box control is set
                    txt_ChartTitle.Value = chartTitle;
                }
            this.Name = reportName;
        }

        private Image CopyImage(Image original)
        {
            Image ret = new Bitmap(original.Width, original.Height);
            using (Graphics g = Graphics.FromImage(ret))
            {
                g.DrawImage(original, 0, 0, original.Width, original.Height);
                g.Save();
            }
            return ret;
        }
    }
Kyle
Top achievements
Rank 1
 asked on 03 Aug 2011
1 answer
396 views
I have a crosstab in my report that needs dynamic columns so I am building the groups/rows/columns in the NeedDataSource method.  To get me started, I set up the crosstab in the designer with 2 columns and bind it to a datatable.  The Crosstab displays the data correctly.  Then I reviewed the designer code, and add the groups/rows/columns exactly how it is done in the designer.  Note:  at this point, I am still just adding the 2 columns, so the crosstab should be exactly the same as when built in the designer.  But when I bind the crosstab to the same datatable, it throws an "Index was out of range...." exception.  Since the groups/rows/columns should be the same as when built in the designer, I could be missing a step prior to adding the groups/rows/columns.  Currently, I am clearing all RowGroups, ColumnGroups, Body.Columns, Body.Rows, and Items from the crosstab.  (then adding the rows/columns/groups)  Is there anything else I need to do?  Do you have any other ideas on what might cause the "Index was out of range..." exception?  Here is my code:
crosstab1.RowGroups.Clear();
crosstab1.ColumnGroups.Clear();
crosstab1.Body.Columns.Clear();
crosstab1.Body.Rows.Clear();
crosstab1.Items.Clear();
crosstab1.Corner.ClearCellContent();
 
crosstab1.Body.Columns.Add(new TableBodyColumn(new Unit(2D, UnitType.Inch)));
crosstab1.Body.Columns.Add(new TableBodyColumn(new Unit(2D, UnitType.Inch)));
crosstab1.Body.Rows.Add(new TableBodyRow(new Unit(0.26D, UnitType.Inch)));
 
TextBox txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "=Fields.Jun2011" };
crosstab1.Items.Add(txtBx);
crosstab1.Body.SetCellContent(0, 0, txtBx);
 
txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "=Fields.Jul2011" };
crosstab1.Items.Add(txtBx);
crosstab1.Body.SetCellContent(0, 1, txtBx);
 
TableGroup group1 = new TableGroup();
group1.Groupings.Add(new Telerik.Reporting.Data.Grouping("=\'ColumnGroup\'"));
txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "June 2011" };
crosstab1.Items.Add(txtBx);
group1.ReportItem = txtBx;
 
TableGroup group2 = new TableGroup();
txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "July 2011" };
crosstab1.Items.Add(txtBx);
group2.ReportItem = txtBx;
 
 
crosstab1.ColumnGroups.Add(group1);
crosstab1.ColumnGroups.Add(group2);
 
txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "Project Name" };
crosstab1.Items.Add(txtBx);
crosstab1.Corner.SetCellContent(0, 0, txtBx);
 
txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "Type Of Financial" };
crosstab1.Items.Add(txtBx);
crosstab1.Corner.SetCellContent(0, 1, txtBx);
 
 
TableGroup group4 = new TableGroup();
group4.Groupings.Add(new Telerik.Reporting.Data.Grouping("=Fields.TypeOfFinancial"));
txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "=Fields.TypeOfFinancial" };
crosstab1.Items.Add(txtBx);
group4.ReportItem = txtBx;
group4.Sortings.Add(new Telerik.Reporting.Data.Sorting("=Fields.TypeOfFinancial", Telerik.Reporting.Data.SortDirection.Asc));
 
 
TableGroup group3 = new TableGroup();
group3.ChildGroups.Add(group4);
group3.Groupings.Add(new Telerik.Reporting.Data.Grouping("=Fields.ProjectName"));
txtBx = new TextBox() { Size = new SizeU(new Unit(2D, UnitType.Inch), new Unit(0.26D, UnitType.Inch)), Value = "=Fields.ProjectName" };
crosstab1.Items.Add(txtBx);
group3.ReportItem = txtBx;
 
crosstab1.RowGroups.Add(group3);
 
crosstab1.DataSource = ConstructDataTable();

Justin Lee
Top achievements
Rank 1
 answered on 02 Aug 2011
3 answers
148 views

I have a senario similar to this:

class CarManufacture
{
    String Name { get; set; }
    String Description { get; set; }
   List<Model> CarModels { get; set; }
   List<Model> TruckModels { get; set; }
}
 
class Model
{
   string ModelName { get; set; }
}


The list of Manufactures will be the datasource, and it won't be a fixed count.  What I want to do is show the Manufactures horizontally, and below them, the lists of cars and trucks.  So something like this:

                Chevrolet            Ford                Nissan
                [Description]        [Discription]    [Description]

Cars        Malibu                Mustang           Altima
                Impala                Fusion              Maxima
                Camaro                                       Versa

Trucks     Colorado            F150                Titan
                Silverado            F250
            

How can I accomplish this?  I'm trying with a CrossTab, but can't quite figure it out.  Are there any examples of something like this?



Justin Lee
Top achievements
Rank 1
 answered on 02 Aug 2011
2 answers
700 views
Hello,

In my code I assign the string "HIGH" to a TextBox in my Report. The report shows the value "HIGH" correctly in the report. I would like to format the TextBox in such a way that the text's colr is Red when it contains "HIGH". Therefore I have created a Conditional Formatting Rule saying  that if TextBoxName.Value = ="HIGH" (see attached image) the the style should have a red font color.

However this does not work. Dies conditional formatting work if the value of the textbox is assigned directly through code?

Any help is appreciated.

Thanks in advance
Ionel
Top achievements
Rank 1
 answered on 02 Aug 2011
2 answers
247 views
Hello.  I have a report with 2 params.  The datasource of the second param uses the selected value of the first param. 
Example:    Param 1 is a list of car manufactures, and Param 2 is a list of Models for the selected car manufacture.

I have set this up, and it is working correctly.  However, what I would like to do is have Param 2 automatically select the first option after the user selects from Param1.
Example:  User chooses "Ford", and "Mustang" is automatically selected in Param 2 (because its the first in the list), and the Mustang report is displayed.  (Currently, after selecting from Param1, the dropdown for Param2 says "<select a value>")

How can I accomplish this?

Thanks,
Justin
Patrick
Top achievements
Rank 1
 answered on 01 Aug 2011
1 answer
115 views
Hello,

I am new to reporting but I have created a new class project for my Telerik Reports and have a simple report working perfect in the report viewer on my aspx page (located in my web project). Now when I try to run the same thing in the Report Designer Preview Tab it fails. I do not have a datasource associated with this report but I do have NeedDataSource. I have determined that the NeedDataSource routine fails (again only in Preview/Html Tabs) when my Linq query tries to iterate through the result set e.g. For Each g In gc...

Again this code works fine when viewed through the WebReportViewer.
Private Sub GoalCompare_NeedDataSource(ByVal sender As Object, ByVal e As System.EventArgs)
...
Dim o As MIBEntitiesModel = New MIBEntitiesModel(My.Settings.MIBConnection)
 
Dim gc As System.Linq.IQueryable(Of MIB1.VwMIB_GoalCompare) = Nothing
 
gc = From m In o.VwMIB_GoalCompares Select m
If iSelectedLevel = enSelectedLevel.DSC Then
    gc = gc.Where(Function(x) x.DistrictWN.Equals(sDSCWN) AndAlso x.Year.Equals(iThisYear) AndAlso x.Week.Equals(iThisWeek))
ElseIf iSelectedLevel = enSelectedLevel.RSC Then
    gc = gc.Where(Function(x) x.RegionalWN.Equals(sRSCWN) AndAlso x.Year.Equals(iThisYear) AndAlso x.Week.Equals(iThisWeek))
ElseIf iSelectedLevel = enSelectedLevel.SSC Then
    gc = gc.Where(Function(x) x.StateWN.Equals(sSSCWN) AndAlso x.Year.Equals(iThisYear) AndAlso x.Week.Equals(iThisWeek))
End If
gc = gc.OrderBy(Function(x) x.LevelID).ThenBy(Function(x) x.UserID).ThenBy(Function(x) x.RowCategoryID)
 
For Each g In gc
...
Next
...
End Sub

Possibly I am missing a required assembly?? Any help would be greatly appreciated! Thank you!
Jeff
Top achievements
Rank 1
 answered on 01 Aug 2011
2 answers
65 views
Hi,

I have a couple of question about the Telerik.Reporting product.

1) I created a report that containt a group. This group have a header and a footer. This group may contain over 40 rows (so, too much to stand on only one page) and I want to know if it was a way to print his header at the beginning of each page. Here a picture of what I mean : link

2) Always with the same report, I want to know if it is possible to show a group as soon as it is loaded, even if the other group aren't, In other worlds, let's said that my report have a group that appears 100 times. What I want is that, the first group appears once it is load, then the second, then the third, ... and not that I have to wait a couple of seconds before they all appears.

3) Last question : is it possible to not show a footer on the first page, but to show it on all the other pages. In fact, I want to show the number of the page, but I not on the first page. I read that I can use report book, but I'm not sure it is the right solution in my case. 

Thank you in advance

PS : I have a another question. It is possible to open a report in a pdf inside a web page (like this). In the learning guide, they only show how to open it in a standard pdf. not inside a web page. Thanks 
David
Top achievements
Rank 1
 answered on 29 Jul 2011
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
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?