2
votes

There is a method in fastreport called RegisterData that creates initial datasource and bind data to it. So, I found a report that is already working in project, but when I'm trying to do the same thing I don't see any datasources in it.

var data = GetData(parameters) as IEnumerable<Days>;
Report.RegisterData(data, "DaysBS", 4)

When I try to select data source from design mode I can't see any? Who knows why? In already excisting report all works fine and I can see all registered datasources

Report.RegisterData(data, "UnUsedPeriodsBS", 4);
var vacationUnUsedPeriodDatas = data.SelectMany(d => d.Periods).ToList();
Report.RegisterData(vacationUnUsedPeriodDatas, "PeriodDetailsBS", 4);
Report.RegisterData(vacationUnUsedPeriodDatas.SelectMany(s => s.PeriodDetails).ToList(), "DaysDetailsBS", 4);

EDIT Tried to manually refer to DaysBS in report design mode and it's working, but I can't understand why I can't see any report data from design mode

2

2 Answers

3
votes

but I can't understand why I can't see any report data from design mode

Try to set tables from your dataset enabled:

Report.GetDataSource("tableName").Enabled = true;
0
votes

So, looks like that the previous man who had coded the working report, first added binding sources, to use them from the report design mode, then deleted them, no idea why... I tried to do so, and fastreport somehow remembered those bindingsources and all works fine.

Thus, there are no binding sources on the report and you can register data from the code like Report.RegisterData(IEnumerable data, "Name of datasource") and it will work