# Load Reports in the .NET API

# The ReportObject Class

All Report type objects inherit from `ReportObject`. The class includes basic functions such as loading and saving the objects. Report type objects consist of simple report types such as express and standard, and composite types such as dashboard and chained.

## Accessing Reports via the API

A Report is normally loaded via API in order to launch directly into the execution or editing of the report. In most cases, report loading is handling by the Exago runtime via the `LoadFromRepository` call. `LoadFromRepository` returns an object of type `ReportObject`. In order for the load to complete, a corresponding `SaveToApi` is done. `SaveToApi` will save the `ReportObject`, including any modifications back to the API for loading (for execution or editing). Both `LoadFromRepository` and `SaveToApi` can be accessed via the `Api.ReportObjectFactory` property.

Both `LoadFromRepository` and `SaveToApi` return and store a `ReportObject` respectively. Most modifications made to a report loaded at runtime (such as changing filter values) are performed on properties defined within the child types (such as `Report` or `DashboardReport`). Such modifications would require a cast of the `ReportObject` to the appropriate child type.

If no modifications are required, the sequence is simple:

    //Load the report.  refers to the full folder path
    //followed by the report name
    ReportObject ro = api.ReportObjectFactory.LoadFromRepository();
    //Save the report back to the API
    api.ReportObjectFactory.SaveToApi(ro);

If modifications are desired, it is necessary to cast the value returned by `LoadFromRepository` to the appropriate base type. Supported base types include `WebReports.Api.Reports.Report` for standard, express, and crosstab reports, `WebReports.Api.Composite.Dashboard.DashboardReport` for dashboards, and `WebReports.Api.Composite.Chained.ChainedReport` for chained reports.

For example, you can modify Filters on a report to be executed as follows:

    //Load the report.  refers to the full folder path
    //followed by the report name
    Report report = api.ReportObjectFactory.LoadFromRepository() as Report;
    report.Filters[0].Value = ;
    //Save the report back to the API
    api.ReportObjectFactory.SaveToApi(report);

Note that the filter change will only apply to this execution of the report. The report design itself will not be modified.

Note also that all elements of the `Report` object (as opposed to the `ReportObject` object!) can be modified in this manner. It is also possible to build a report from scratch in the API. There are examples in production of clients that have programatically built their own reports.