TfrxUserDataSet
Hi all
I'm trying to build a report in code. I'd like to have a TfrxMasterData and an associated TfrxUserDataSet. So far I can 'inject' the items into the report and the appear on the correct pages. However I'm struggling to get the user data to get data from the
OnGetValue, OnFirst, OnNext, OnPrior
as the events aren't being called. What newbie mistake am I making...? [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> Code snippet: var MasterData : TfrxMasterData; ds : TfrxUserDataSet; DataPage : TfrxDataPage; begin if FReport.Pages[0] is TfrxDataPage then DataPage := FReport.Pages[0] as TfrxDataPage; MasterData := TfrxMasterData.Create(APage); MasterData.CreateUniqueName; MasterData.Left := DesignToPageX(AX, AParentPanel.Width, APage.Width); MasterData.Top := DesignToPageY(AY, AParentPanel.Height, APage.Height); MasterData.Width := 500; MasterData.Height := 50; MasterData.Overflow := true; ds := TfrxUserDataSet.Create(DataPage); ds.CreateUniqueName; ds.RangeEnd := reCount; ds.RangeEndCount := 10; ds.Fields.Add('Field1'); ds.OnGetValue := UserDataSetGetValue; ds.OnFirst := UserDataSetFirst; ds.OnNext := UserDataSetNext; ds.OnPrior := UserDataSetPrior; MasterData.DataSet := ds; FReport.DataSets.Add(ds)[/img]
I'm trying to build a report in code. I'd like to have a TfrxMasterData and an associated TfrxUserDataSet. So far I can 'inject' the items into the report and the appear on the correct pages. However I'm struggling to get the user data to get data from the
OnGetValue, OnFirst, OnNext, OnPrior
as the events aren't being called. What newbie mistake am I making...? [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> Code snippet: var MasterData : TfrxMasterData; ds : TfrxUserDataSet; DataPage : TfrxDataPage; begin if FReport.Pages[0] is TfrxDataPage then DataPage := FReport.Pages[0] as TfrxDataPage; MasterData := TfrxMasterData.Create(APage); MasterData.CreateUniqueName; MasterData.Left := DesignToPageX(AX, AParentPanel.Width, APage.Width); MasterData.Top := DesignToPageY(AY, AParentPanel.Height, APage.Height); MasterData.Width := 500; MasterData.Height := 50; MasterData.Overflow := true; ds := TfrxUserDataSet.Create(DataPage); ds.CreateUniqueName; ds.RangeEnd := reCount; ds.RangeEndCount := 10; ds.Fields.Add('Field1'); ds.OnGetValue := UserDataSetGetValue; ds.OnFirst := UserDataSetFirst; ds.OnNext := UserDataSetNext; ds.OnPrior := UserDataSetPrior; MasterData.DataSet := ds; FReport.DataSets.Add(ds)[/img]
Comments
Look at the masterdetail uds demo in your fastreport 4/demos folder.
Ok, thanks. Confusion for me is that I'm creating the MasterData and UserDataSet in code, no forms. Our customers require very flexable reporting so it's done on the fly as the create them.
As I've got the MasterData/MemoView working fine now I'll just go with it and not use the UserDataSet...
Friday brain fry. Will look at the UserDataSet on Monday again.