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 9:02PM
    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 9:02PM
    thanks
    it means that relations never appeared in the report files
  • edited 9:02PM
    Relation will be enabled automatically if its datasources (parent and child) are enabled.
  • edited 9:02PM
    thanks
  • edited 9:02PM
    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 9:02PM
    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 9:02PM
    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 9:02PM
    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 9:02PM
    thanks

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.