Loading .fr3 that includes datasets

Hi all,

I've designed a report on a form, that included two TfrxDBDatasets (one linked to the report page, and one to a master data band). That previews fine.

I'm now trying to put it all into a class that loads the saved .fr3 file and I'm having trouble with the datasets. I'm creating TClientDataSets, then creating TfrxDBDatasets and linking them to their TClientDataSet, and giving them the same Username as was saved in the .fr3 file.

But it gives me an exception "Cannot find class TfrxDBDataset" when preparing the report. I'm setting all the memo field datasets too. I feel like I'm doing something wrong.

Does anyone have some sample code that works?

Many thanks.

Comments

  • gpigpi
    edited 2:53PM
    Create a small demo project with problem based on standart Delphi's components and FRDemo database and send it to support@fast-report.com
  • edited 2:53PM
    gpi wrote: »
    Create a small demo project with problem based on standart Delphi's components and FRDemo database and send it to support@fast-report.com

    I can't find FRDemo on my system. I'm using FastReports 5 that came loaded with Delphi XE8.

    Do you have example code for a console application that loads a '.fr3' file, and uses TfrxDBDataset?
  • edited 2:53PM
    Here's what I've learned so far when creating the TfrxReport object at runtime:

    If after loading a .fr3 file it references any TfrxDBDataset components - it will fail unless the TfrxDBDataset component was created at design-time. Creating the TfrxDBDataset at runtime causes TfrxReport.PrepareReport to raise an exception saying it cannot find the TfrxDBDataset component.

    I noticed that after loading the .fr3 file, TfrxReport.Datasets[0].Dataset is nil, whereas during tests where everything is created at design-time, that property references the TfrxDBDataset component. All my attempts to fix this property reference result in AV exceptions, including using TFrxReport.Datasets.Add.

    If you could post a working sample of a console application, that would solve all my problems.

    Thank you.
  • edited 2:53PM
    SOLVED!

    Something that I thought was important, was actually the cause of the problem.

    Setting TfrxDBDataset.Parent to anything causes the error about not being able to find the dataset.

    So, it works by creating the TfrxReport object, creating the dataset (eg TADOQuery), creating the TfrxDBDataset, setting the UserName property to what the .fr3 file specifies, and away it goes.

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.