C# Business Objects Demo

Hi,

I am evaluating FastReport and I want to use Business Objects as datasource for the reports.
So I looked at the DataFromBusinessObject demo which I opened in VS2005.
But when I run it and choose "Create new report", Fast Report comes up with a blanc report, but there is no
Business Object data to choose from. It doesn't appear on the data-tab.
Even if I choose "Run Existing Report" and then in the preview windows choose for "Edit Page", the data-tab still doesn't show the Business Object.
Is this normal behavior or is this feature not available in the Demo version of Fast Report??

Greetings,

Marco

Comments

  • edited 6:42PM
    Hello,

    This is normal behavior, you should select the data source(s) in the "Data|Choose Report Data..." menu.
  • edited 6:42PM
    Dear Alex,

    Aaahhh, I see the Business Object now, that's great.
    But, is there a way to do this from code??
    Choosing the Report data I mean.
  • edited 6:42PM
    You can do this in code, but this is not recommended for BO with very complicated structure.
    report.RegisterData(myData, "MyData");
    report.GetDataSource("MyData").Enabled = true;
  • edited 6:42PM
    I see the first level (categories) now.
    But how do I make all sub-objects appear??

    I tried the colums collection, and that works fine for the products.
    But I added a list of Calculation-classes to the Product class like this:

    Class Categorie
    {
    private List<Product> FProducts;
    public List<Product> Products
    {
    get { return FProducts; }
    }
    }

    Class Product
    {
    private List<Calculation> FCalculations;
    public List<Calculation> Calculations
    {
    get { return FCalculations; }
    }
    }
    Class Calculation
    {
    }

    This is the function to set all objects.enabled = true

    private void enableAll(FastReport.Data.BusinessObjectDataSource dsb)
    {
    dsb.Enabled = true;
    foreach (FastReport.Data.Column c in dsb.Columns)
    {
    if (c is FastReport.Data.BusinessObjectDataSource)
    {
    enableAll((FastReport.Data.BusinessObjectDataSource)c);
    }
    }
    }

    The function-call is like: enableAll(report.GetDataSource("MyData"));

    When the enabledAll() is called for the second time, the dsb.columns.count is zero.

    So how do I make all sub-objects appear??
  • edited 6:42PM
    When register the data, set maxNestingLevel param to 2 or more:
    report.RegisterData(myData, "MyData", 2);
    report.GetDataSource("MyData").Enabled = true;
    report.GetDataSource("MyData.NestedData").Enabled = true;

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.