Filter in Multiple Databand

I have tried a report with two database - to make a master and Detail Report, Bind both Data band with different Tables, and in Child Database, Applied Filtered like
ChildTable.MasterId = MasterTable.Id .... Now its showing Records in Child databand related to master Band.... But incase if any Data of master Don't have any Record in Child Table, the master Data band also not showing Records... Can you anyone please explained me how to handle such report where there is no separate Headers requires and avoid Sub Reports...

Thanks

Comments

  • edited January 2017
    don't use two databands and subreport, push one datatable to fastreport, use LinQ :
    //FROM DATABASE#1
    DataTable dt1 = new DataTable();
    dt1.Columns.Add("id", typeof(Int32));
    dt1.Columns.Add("name", typeof(string));
    dt1.Rows.Add(1, "alpha");
    dt1.Rows.Add(2, "beta");
    
    //FROM DATABASE#2
    DataTable dt2 = new DataTable();
    dt2.Columns.Add("id", typeof(Int32));
    dt2.Columns.Add("value", typeof(Int32));
    dt2.Columns.Add("parent", typeof(Int32));
    dt2.Rows.Add(1, 100, 1);
    dt2.Rows.Add(2, 1000, 1);
    
    //RESULTS FROM DATABASE#1 LEFT OUTER JOIN DATABASE#2
    DataTable dt3 = new DataTable();
    dt3.Columns.Add("id", typeof(Int32));
    dt3.Columns.Add("name", typeof(string));
    dt3.Columns.Add("value", typeof(Int32));
    
    //LINQ => PERFORM LEFT OUTER JOIN QUERY
    var query = from data1 in dt1.AsEnumerable()
                      join data2 in dt2.AsEnumerable()
                      on data1.Field<Int32>("id")
                      equals data2.Field<Int32>("parent")
                      into leftouterjoin
                      from rows in leftouterjoin.DefaultIfEmpty()
                      select dt3.LoadDataRow(new object[] {
                           data1.Field<Int32>("id"),
                           data1.Field<string>("name"),
                           rows == null ? DBNull.Value : (object) rows.Field<Int32>("value")
                      }, false);
    query.CopyToDataTable();
    
    //OUTPUTTING RESULTS
    foreach (DataRow row in dt3.Rows)
    {
        MessageBox.Show(string.Format("id={0}\r\nname={1}\r\nvalue={2}", row[0], row[1], row[2]));
    }
    

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.