Hello,
I am interested in VirtualDac to virtualize the access to tables that does not have the Recno property ( for example Elevatedb ), but has the RecordCount and BookMark properties instead of Recnos.
If I set the property OnGetFieldValue of a TVirtualDataSet to a procedure for example :
procedure TfmMain.DeptDataSetGetFieldValue(Sender: TObject; Field: TField; RecNo: Integer; out Value: Variant);
The procedure pass as parameter a Recno ( that I do not have in this kind of tables ), but in this case I need a bookmark instead.
Would it possible to implement new events oriented to work with bookmarks instead of Recnos?.
Thank you.
TVirtualDataSet working with tables that does not have the recno property.
Re: TVirtualDataSet working with tables that does not have the recno property.
The event handler OnGetFieldValue in the VirtualDataSet component is designed to return data to a virtual dataset. The RecNo parameter is not related to the record number in the physical table Elevatedb or any database. According to the business logic in your application, this handler should implement the correspondence between the RecNo of the prepared dataset and some unique identifier of the dataset (for example, RecordCount or BookMark).
Re: TVirtualDataSet working with tables that does not have the recno property.
Hello,
Suppose that Tb1 is the name of the elevatedb table and DeptDataSet is a TVirtualDataSet and that I do not set Filters or Ranges to the DeptDataSet table ( or any other method that would break the relation between the DeptDataSet.Recno and the Tb1.Recno ) and suppose that I have written in the procedure of response to the OnGetFieldValue event of the DeptDataSet table :
procedure TfmMain.DeptDataSetGetFieldValue(Sender: TObject; Field: TField; RecNo: Integer; out Value: Variant);
begin
Tb1.Recno:=Recno;
Value:=Tb1.FieldByName(Field.FieldName).Value;
end;
As I cannot do Tb1.Recno := Recno because Tb1 does not supports the recno property, how do I move Tb1 to the spected position?. OnGetFieldValue is oriented to work with lists, not with a sequenced list that I cannot access by its index.
Can you put an example with your suggestion?.
Thank you.
Suppose that Tb1 is the name of the elevatedb table and DeptDataSet is a TVirtualDataSet and that I do not set Filters or Ranges to the DeptDataSet table ( or any other method that would break the relation between the DeptDataSet.Recno and the Tb1.Recno ) and suppose that I have written in the procedure of response to the OnGetFieldValue event of the DeptDataSet table :
procedure TfmMain.DeptDataSetGetFieldValue(Sender: TObject; Field: TField; RecNo: Integer; out Value: Variant);
begin
Tb1.Recno:=Recno;
Value:=Tb1.FieldByName(Field.FieldName).Value;
end;
As I cannot do Tb1.Recno := Recno because Tb1 does not supports the recno property, how do I move Tb1 to the spected position?. OnGetFieldValue is oriented to work with lists, not with a sequenced list that I cannot access by its index.
Can you put an example with your suggestion?.
Thank you.
Re: TVirtualDataSet working with tables that does not have the recno property.
You can find an example of using TVirtualDataSet in the Demo project, which is distributed with VirtualDAC: [VirtualDAC Demo Folder]\Demos\VirtualDataSet\