Filter data by code

mohanarajmohanaraj 600001
edited January 2010 in FastReport .NET
Hello

I want to filter the data in the data source which i was registered to the report , in the collection i want to filter only the data which parentId = 0 i use the below code but it throw an error whats wrong in this ?

dataBand.DataSource = FReport.GetDataSource("dtorgSummary");
dataBand.Filter = "[dtOrgsummary.ParentId] == 0 ";


and also How to create the relation for the report datasource

Relation relationForDept = new Relation();
relationForDept.Name = "dtOrgsummary_dtOrgDeptsummary";
relationForDept.ReferenceName = "Data.dtOrgsummary_dtOrgDeptsummary";
relationForDept.ParentDataSource = "dtOrgsummary";
relationForDept.ChildDataSource = "dtOrgDeptsummary";
relationForDept.ParentColumns = "DepartmentId";
relationForDept.ChildColumns = "DepartmentId";
relationForDept.Enabled = "true";

how add this relation to the report?

thanks,

Comments

  • edited 9:07AM
    Hello,

    What error do you get?

    Please see the Class Reference on "Relation" class. It has an example on how to add a relation:

    /// Report report1;
    /// DataSourceBase customersTable = report1.Dictionary.DataSources.FindByAlias("Customers");
    /// DataSourceBase ordersTable = report1.Dictionary.DataSources.FindByAlias("Orders");
    /// Relation rel = new Relation();
    /// rel.Name = "customersOrders";
    /// rel.ParentDataSource = customersTable;
    /// rel.ChildDataSource = ordersTable;
    /// rel.ParentColumns = new string[] { "CustomerID" };
    /// rel.ParentColumns = new string[] { "CustomerID" };
    /// report1.Dictionary.Relations.Add(rel);

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.