Riport on the fly

Hello,



I use the following code from Delphi:
InvoiceDataSet:= TfrxDBDataset.Create(nil);
InvoiceDataSet.DataSource := InvoiceBrowseForm.InvoiceBrowseSource;

frxReport.LoadFromFile('FR\report1.fr3');


//
DataBandMaster := ADatForm.frxReport.FindObject('MasterData1') as TfrxMasterData;
DataBandMaster.DataSet := InvoiceDataSet;
//

//
Memo := ADatForm.frxReport.FindObject('MemoNo') as TfrxMemoView;
Memo.DataSet := InvoiceDataSet;
//


I have the report:
- the MasterData1.Dataset is not assigned in the file, it is assigned in the code above
- the MemoView doesn't work with the Delphi code (above), I tried the followings:
[InvoiceDataSet."Location"]
[<"Location">]

The main problem is that I can't use DataField of the memo because I use two fields in the same memo (it is not described here because I don't want to seem more complicated).
I think the problem is that the InvoiceDataSet is created on the fly and somehow the Memo's text doesn't recognize it.






Comments

  • gordkgordk St.Catherines On. Canada.
    edited 2:59PM
    first when you create the frxdbdataset did you set its username property.

    frxReport.LoadFromFile('FR\report1.fr3');

    is this the same report as the one above as it does not have a form reference
    //
    DataBandMaster := ADatForm.frxReport.FindObject('MasterData1') as TfrxMasterData;
    DataBandMaster.DataSet := InvoiceDataSet;
    //
    did you add the dataset to the reports active datasets

    don't connect the memo to the dataset set its texproperties using the add method for each line
    you want to add memo1.text.add('[datasetusername."fieldname"]')
    or if more fields on one line
    memo1.text.add('[datasetusername."fieldname1"] [datasetusername."fieldname1"] ');
    when trouble shooting a report add the designer to the project
    and call design report instead of show report this way you can see what has changed in the report.



  • edited 2:59PM
    Thank you Gordk,

    You helped me a lot to understand it.
    The last problem was that TfrxDBDataset creation was before frxReport.LoadFromFile('FR\report1.fr3'); and the LoadFromFile "sweeped" out the settings before.

    Now it works, thanks to you.

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.