Datasource Text = "[reportData.Description]" vs "[reportData.ConfigStatusComponent.Description]",
Using TextObject() and RegisterData All code works well until I change the following:
The following works when I do my report....
Text = "[reportData.Description]" ;
I need to add the following.... is this the proper syntax? I get an error on report.Prepare();
Text = "[reportData.ConfigStatusComponent.Description]" ;
//Get data source
var configStatusComponentApplicationID = await ConfigStatusComponentController.GetDescriptionID(_context, ModelName.Application.Value);
var configStatusComponentContractID = await ConfigStatusComponentController.GetDescriptionID(_context, ModelName.Contract.Value);
var ConfigStatusComponentTypeList = await _context.ConfigStatusComponentTypes.Where(w => w.ConfigStatusComponentID == configStatusComponentApplicationID || w.ConfigStatusComponentID == configStatusComponentContractID).Include(i => i.ConfigStatusComponent).OrderBy(o => o.ConfigStatusComponent.Description).ThenBy(o => o.DisplayOrder).ToListAsync();
//Set Data Source
var reportData = ConfigStatusComponentTypeList;
report.RegisterData(reportData, "reportData");
report.GetDataSource(reportDataName).Enabled = true;
....create a TextObject
var result = new TextObject()
{
Bounds = new RectangleF(toLeft, toTop, toWidth, toHeight),
//result.Bounds = new RectangleF(0, 0,Units.Centimeters * 10, Units.Centimeters * 0.5f);
AutoWidth = true,
Font = toFont,
Text = "[reportData.Description]",
HorzAlign = HorzAlign.Left
};
Comments
ConfigStatusComponent is 'business object'/'poco class' name, fastreport uses alias as reference name.
Report.RegisterData(IEnumerable, string)
ok...I changed my code to
.Select(s=> new { Description = s.ConfigStatusComponent.Description,Description2=s.Description}).ToListAsync();
and that gets me a simple IEnumerable list