New old topic, Class not found


So on to my problem. I'm creating the report in code (yes, our users don't want to see the report designer hell)... for example adding a Master Data to the report from code.

var
MasterData : TfrxMasterData;
MemoView : TfrxMemoView;
ds : TfrxUserDataSet;
begin
MasterData := TfrxMasterData.Create(APage);
MasterData.CreateUniqueName;

ds := TfrxUserDataSet.Create(MasterData);
ds.CreateUniqueName;
ds.RangeEnd := reCount;
ds.RangeEndCount := 10;
ds.OnGetValue := UserDataSetGetValue;

MasterData.DataSet := ds;

When I preview the report I get:

ERROR : Project raised exception class EClassNotFound with message 'Class TfrxUserDataSet not found'.

Yes, yes, I do have a TfrxUserDataSet component on the form that 'hosts' the tfrxReport. frxClass is in the uses clause. Getting rather frustrated with it....

HELP, HELP, HELP, HELP, HELP, PLEASE HELP!!!!!!!!!!!!!!!!!!!!!!!!

Comments

  • gpigpi
    edited 8:53PM
    What IDE do you use? Show your uses list
  • edited October 2012
    Hi

    Delphi XE

    The form unit that has the "frxReport" and "frxPreviedw" uses clause:

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,
    cxPCdxBarPopupMenu, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters, ExtCtrls, cxPC, Printers,
    Spin, ReportDesigner, ReportCommon, frxPreview, dxSkinsCore, dxSkinBlueprint, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle,
    dxSkinHighContrast, dxSkinSevenClassic, dxSkinSharpPlus, dxSkinTheAsphaltWorld, dxSkinVS2010, dxSkinWhiteprint, dxSkinscxPCPainter,
    frxClass, frxBDEComponents, frxExportPDF, Mask, frxDBSet, frxADOComponents, frxDBXComponents;

    the frxReport is passed through to another unit that adds the code shown in my fist post.

    =============================

    Could this be a problem with the FastReport packages, installation? Has anyone tried the recompile option for FastReport? I really need to move forward with this...

    Thanks
  • edited 8:53PM

    Yep, this product is dead in the water isn't it? >
  • gpigpi
    edited 8:53PM
    Try
    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,
    cxPCdxBarPopupMenu, cxGraphics, cxControls, cxLookAndFeels, ExtCtrls, cxPC, Printers,
    Spin, ReportDesigner, ReportCommon, frxPreview, frxDBSet,
    frxClass, frxBDEComponents, frxExportPDF, Mask, frxADOComponents, frxDBXComponents;
    
  • edited 8:53PM

    Thanks but this doesn't work either. At this stage I think I'll try to reinstall the FastReport controls. If that doesn't work then there are thankfully other reporting tools that I can use...
  • gpigpi
    edited 8:53PM
    Try to compile demo project from MasterDetailUDS folder. Did you get same result?
  • edited 8:53PM
    gdi. I've done that and the project compiles, runs and previews without problem...

    I've tried copying the 'uses' clause into my project but have the problem still. To reiterate the problem isn't during compilation but when I call the method to add the masterdetail with userdata to the report.
  • edited 8:53PM
    UPDATE:

    I noticed that if I included, for example, frxClass to the 'uses' clause of my project right clicking on it and selecting 'Find Declaration' didn't take me to the unit. After running the Fast Report Recompile utility this now works.

    Unfortunately I still have the 'Class TfrxUserDataSet not found' error when I try to create a TfrxMasterData with a TfrxUserDataSet to the report...

    Getting nowhere fast!
  • edited 8:53PM

    SOLUTION:

    After stepping through the code for a bit I've found that for some reason the FastReport code was failing at a FindClass() call, looking for TfrxUserDataSet.

    So all you have to do is add a RegisterClass(TfrxUserDataSet); to the create() of the application to solve the problem.

    Thanks

    >[img]style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> P.S. Fast Report guy(s). You could support a bit more even when the problem is more Delphi/user than FastReport. Though why the UserDataSet isn't registered is beyond me.... anyway, onwards!!![/img]>
  • I had something similar occur (on runtime cannot load TfrxUserDataSet)

    my issue was the type of TComponent I was registering as the owner of the new components on run time

    My mistake was

    TfrxUserDataSet *userSet = new TfrxUserDataSet(TfrxReport);


    The report cannot initialize ownership of the TfrxUserDataSet. However changing it to the form that can initialize ownership of the TComponent works

    TfrxUserDataSet *userSet = new TfrxUserDataSet(TDataModule/TForm);

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.