Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 19 Mar 2024, 08:23

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 03 Aug 2022, 10:07 
Offline

Joined: 29 Oct 2013, 11:58
Posts: 13
hello .. TMemTableEh can't load calculated fileds from source dataset ...is there any solution?


Top
 Profile  
 
PostPosted: 08 Aug 2022, 17:33 
Offline

Joined: 08 May 2014, 18:06
Posts: 657
Hello

And how should the calculated fields be copied to the new DataSet ?
After all, the algorithm for calculating the calculated fields is stored in the original DataSet, in the OnCalcFields event handler.

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 09 Aug 2022, 12:13 
Offline

Joined: 29 Oct 2013, 11:58
Posts: 13
EhLibSupport wrote:
Hello

And how should the calculated fields be copied to the new DataSet ?
After all, the algorithm for calculating the calculated fields is stored in the original DataSet, in the OnCalcFields event handler.


of course, the value of the field is calculated in OnCalcFields event ; but the field itself is created previously in onCreate event ();
TDatasetDrivereh can't retrieve calculated fields and lookup fields. (persistent fields)
New_Persistent_Fields

Update : to solve this problem; fields are manually created with same names in OnbuildDataStruct event.
the good thing is that data are loaded automatically to memtableeh fields.

Code:
procedure TForm1.ddMemTableEh1BuildDataStruct(DataDriver: TDataDriverEh;
  DataStruct: TMTDataStructEh);
  var FIELD1 : TMTStringDataFieldEh;
        FIELD2 : TMTNumericDataFieldEh;
begin



    DataDriver.DefaultBuildDataStruct(DataStruct);

    FIELD1 := TMTStringDataFieldEh(DataStruct.CreateField(TMTStringDataFieldEh));
    FIELD1.FieldName := 'OBS' ;
    FIELD1.Size := 200;

    FIELD2 := TMTNumericDataFieldEh(DataStruct.CreateField(TMTNumericDataFieldEh));
    FIELD2.FieldName := 'MONT_PPA_01' ;
    FIELD2.NumericDataType := fdtFloatEh;
    FIELD2.DisplayWidth := 10;
    FIELD2.Precision := 15;
    FIELD2.DisplayFormat := '#,#0.00';

end;


Top
 Profile  
 
PostPosted: 09 Aug 2022, 22:17 
Offline

Joined: 08 May 2014, 18:06
Posts: 657
But the new fields will no longer be calculated. Also will not change values if the data in dependent fields changes.

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 10 Aug 2022, 12:25 
Offline

Joined: 29 Oct 2013, 11:58
Posts: 13
EhLibSupport wrote:
But the new fields will no longer be calculated. Also will not change values if the data in dependent fields changes.


exact ; but now the most important thing for me is retrieving lookup fields.
and for updating data in memtableEh just do close/open.

thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group