EhLib
ContentsIndexHome
PreviousUpNext
Quick access to the record values

To get values of the fields from specified record in standard DataSet, it is necessary to move to the required record. This not always suitable since when you move to the record using MoveBy, RecNo, Bookmark methods calls events about changing the record position that can bring about big delays and repaint of the screen. 

There are several ways in MemTableEh that allow to get values of the fields without activations record position.

  1. You can use DisableControls, EnableControls methods to deactivate events about changes in DataSet. Disadvantage of this way is that EnableControls causes event about changes DataSet, that will repaint visual component connected to DataSet.
  2. You can use InstantReadEnter, InstantReadLeave methods to enter in InstantRead mode. InstantReadEnter enters in mode of viewing records and moves virtual position to the record determined by the RowNum parameter. After that you can read but don’t change values of record. Each call of InstantReadEnter method, must correspond call InstantReadLeave. InstantReadLeave leave a viewing records mode. In InstantRead mode it is not allowed to change values of record. InstantReadEnter and InstantReadLeave methods do not send events about changing position in DataSet.
  3. You can use properties to access internal array of records of MemTableEh. Internal objects allow to access values of record as to the array of data with index. Besides you may addresses to all writing an internal array given disregarding local filter. For access to internal structures of data you need to use following properties of TMemTableEh:
Property name 
Property type 
Description 
RecordsView 
TRecordsViewEh 
Filtered list of records. 
RecordsView.Rec[Index: Integer] 
TMemoryRecordEh 
Access to certain record in filtered list of records. 
RecordsView.Count 
Integer 
Count of records in the filtered list of records. In TreeView mode list have only visible in expanded nodes. 
RecordsView.MemTableData.RecordsList[Index: Integer] 
TMemoryRecordEh 
Access to certain record in the list of all records. 
RecordsView.MemTableData.RecordsList.Count 
 
Count of records in list of all records. 
cordsView.MemTableData.RecordsList[Index: Integer].DataValues[const FieldNames: string; DataValueVersion: TDataValueVersionEh] 
Variant 
Access to certain value of field in record specified by Index. 

 

Copying data from/to another DataSet. 

TMemTableEh affords the following methods for copying data from/to another DataSet: 

 

  • SaveToDataSet method

Copying it own data in another DataSet, specified by Dest parameter. If RecordCount parameter > 0, the copying begins from current record of source DataSet and copy not more then RecordCount record. If RecordCount = 0 then all records will be copied. When copying the MemTable always add records in Dest DataSet. 

 

  • LoadFromDataSet method

Loads not more then RecordCount records from Source DataSet to itself. If RecordCount = -1 then it load all record. If Mode parameter is lmCopy then all data will be deleted before loading. If Mode parameter is lmAppend then new records will be added to existing data. 

UseIfCachedUpdates parameter define that new records gets usInserted status.

Copyright (c) 1998-2013. All rights reserved.
What do you think about this topic? Send feedback!