Problem in DataSet Registration

hello
Report report = new Report();
var dataSet1 = new DataSet1();
report.RegisterData(dataSet1, dataSet1.DataSetName);
but after these lines
when I Save Report
report.Save("");
no DataSource information (Tables , Relations) found in Dictionary Node.

thanks

Comments

  • edited 12:58PM
    Hello,

    FastReport does not save database items that are not enabled. When you call RegisterData method, all DataSet items are added into the dictionary, but they are all disabled. You have to enable necessary items via the "Report|Choose Report Data..." menu or programmatically. In the latter case, use the following code:

    report.GetDataSource("table_name").Enabled = true;
  • edited 12:58PM
    thanks
    it means that relations never appeared in the report files
  • edited 12:58PM
    Relation will be enabled automatically if its datasources (parent and child) are enabled.
  • edited 12:58PM
    thanks
  • edited 12:58PM
    hello
    I register All Tables of Dataset but no relation enabled in the report,
    I have to go to the design mode and define their relations!
  • edited 12:58PM
    Hello,

    How do you register tables? If you call report.RegisterData for each DataTable in your DataSet, it won't register relations. To do this, register entire DataSet:

    report.RegisterData(your_DataSet, "ds_name");

    In this case, all DataTables and Relations will be registered.
  • edited 12:58PM
    Ok But when I Register DataSet when seeing my report in Design mode
    the Relations are not available ,DataTables are not available too but by enableing them they are appeared in design mode but no relation found
  • edited 12:58PM
    I see. To enable relations (after you have enabled data tables), use the following code:
          foreach (Relation relation in report.Dictionary.Relations)
          {
            relation.Enabled = relation.ParentDataSource != null && relation.ParentDataSource.Enabled &&
              relation.ChildDataSource != null && relation.ChildDataSource.Enabled;
          }
    
  • edited 12:58PM
    thanks

Leave a Comment