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

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.