Telerik Forums
Reporting Forum
1 answer
392 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
140 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
671 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
232 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
106 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
61 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
2 answers
213 views
hello,

I am using telerik cross tab report but unable to load large data. Report generation proccess is too slow or result in out of memory exception. My stored procedure come up with all records in 1 min and 14 seconds but report don't come up after many minutes, but the same report working fine for 5000 records. Please share the solution?

Thanks

Peter
Telerik team
 answered on 29 Jul 2011
1 answer
131 views
I have an issue with Telerik Reporting Q3 2009 when I export a report to PDF.  The report has a textbox and a table.  The textbox content takes up about 1/4 of a page and the table content takes up about a full page (or more).

What I want is the for table to start immediately after the textbox but I've found that unless the entire table fits on the same page as the textbox it starts rendering on the 2nd page.

Instead of:
[page 1] Textbox + Whitespace
[page 2] Table
[page 3] Table continued

I want:
[page 1] Textbox + Table
[page 2] Table continued

I've played with KeepTogether property but it didn't make a difference.  Any help is appreciated!  Thanks.
Steve
Telerik team
 answered on 29 Jul 2011
2 answers
811 views
Hi guys,

I have two fields on a report (start date and end date) and I'd like to create a calculated field showing the number of hours. I can't find any date formatting functions such as datediff, datepart etc that would allow me to do this. Any ideas? I guess I could add a field to the sql server view but it would cause complications in another tier...
Steven
Top achievements
Rank 1
 answered on 29 Jul 2011
1 answer
239 views
Hi,

I need show data of three different datasources in the same report. I'm trying to use a subreport but I don´t have success. 

public class ViagemInfo
{
    public int IDEmpresa { get; set; }
    public int AnoViagem { get; set; }
    public int IDViagem { get; set; }
    public int IDConta { get; set; }
    public List<MotoristaViagemInfo> MotoristasViagem { get; set; }
}
 
public class MotoristaViagemInfo
{
    public int IDMotorista { get; set; }
    public int Nome { get; set; }
}
     
private void LoadData(int IdEmpresa, int AnoViagem, int IdViagem)
{
    ViagemInfo viagemInfo;
    try
    {
        using (PedidoProxy.Pedido svcProxy = new PedidoProxy.Pedido())
        {
            //load the ViagemInfo with a List<MotoristaViagemInfo>
            viagemInfo = svcProxy.ObterViagemDetalhada(IdEmpresa);
        }
        CertificadoViagem reportCertificado = new CertificadoViagem();
        reportCertificado.ReportParameters["IdEmpresa"].Value = IdEmpresa;
        reportCertificado.DataSource = viagemInfo;
    }
    catch
    {
        throw;
    }
}

How am I set a datasource of subreport with a MotoristasViagem property of viagemInfo?
Peter
Telerik team
 answered on 28 Jul 2011
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?