I was asked how you can access the data in an Office Accounting report in code. As the code shows below this is very simple – you just have to remember a few things:


·         There is no guarantee that the columns in the data view won’t change between versions

·         If you use the groups make sure to iterate through the sub groups as that may be where the data lives


ISmallBusinessInstance instance = (ISmallBusinessInstance)sbaObjects.SmallBusinessInstance;

IReportEngineV2 reportEngine = (IReportEngineV2)sbaObjects.ReportEngine;


// Get a report descriptor

IReportDescriptorV2 reportDescriptor

    = reportEngine.ReportDescriptorView.GetByName("CustomerTransactionHistory");


// Use the report descriptor to create a report executor

INativeReportExecutorV2 reportExecutor

    = (INativeReportExecutorV2)reportEngine.GetReportExecutor(reportDescriptor);


// Let's change a filter on the report

// just to show that you can modify the report before running the report

IReportFilterDateV2 filterDate =



filterDate.DateFilter = DateFilter.All;


// Access the dataView, this will automatically

// run the report if it hasn't been run

DataView dataView = reportExecutor.ReportDocument.DataView;


// Another way To access the data would be through the groups:

foreach (IReportGroupV3 group in reportExecutor.ReportDocument.ReportGroups)


    // A dataView with the data in this group

    DateView dataInThisGroup = group.GroupDataViewRows;


    // In some reports groups may have sub groups

    // You can easily iterate these as well

    foreach (IReportGroupV3 subGroup in group.SubGroups)

    { }