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.
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
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.
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.