Hi,
I am not sure on what could be happening here, but this should work correctly. I made a small demo to try is, which you can get here: https://download.tmssoftware.com/flexcel/samples/master-detail.zip
It creates the report as expected:
Do you see anything different in your app that could cause it to behave differently? What I can think of is:
In the example I used in-memory ClientDataSets, so there is no real issue as no data is fetched from a server. But sometimes DataSets can return "0" as the record count if no records are fetched yet, and FlexCel will assume there are 0 records and so give empty results. I assume that when there is data in the first row, it fetches the full thing, so you don't see the error.
In FlexCel 3, we had a property "CalcRecordCount" in the FlexCelReport, which you could set to "SlowCount":
/// <summary>
/// Defines how TFlexCelReport will count the records in a TDataSet.<para></para>
/// See <see cref="TFlexCelReport.CalcRecordCount" text="CalcRecordCount Property" /> for more
/// information.
/// </summary>
TCalcRecordCount=(
/// <summary>
/// FlexCel will assume RecordCount is returning a correct value. See <see cref="TFlexCelReport.CalcRecordCount" text="CalcRecordCount Property" />
/// for more information.
/// </summary>
cr_None,
/// <summary>
/// FlexCel will do a db.Last command and assume the number returned by RecordCount is ok. See <see cref="TFlexCelReport.CalcRecordCount" text="CalcRecordCount Property" />
/// for more information.
/// </summary>
cr_Count,
/// <summary>
/// FlexCel will count all records in the database, assuming RecordCount is returning an incorrect value.
/// See <see cref="TFlexCelReport.CalcRecordCount" text="CalcRecordCount Property" /> for more
/// information.
/// </summary>
cr_SlowCount);
Can you check if your old reports have this property set? If so, you might need to set the same in FlexCel 7. Now it is not anymore a property of the full report, but for each individual dataset (so you can have some with slowcount and some with not).
In this example, to set slowcount you would change the AddTables to be:
Report.AddTable('master', CDSMaster, TRecordCountMode.SlowCount);
Report.AddTable('detail', CDSDetail, TRecordCountMode.SlowCount);
Note: if you are using FireDac, try setting RecordCountMode in the component itself, it will be faster than setting SlowCount in FlexCel.
There is more information here:
Let me know it this was the issue, or if the problem still persists.