goodday
asked on
Faster ...
Hi,
I'm trying to iterate through a large table and change the value of a field. Using Edit & Post takes a long time.
Is there any significantly faster way to do it?
(I thought of something like writing directly to the recordbuffer.)
A fast way to populate a ClientDataSet without a provider with the data of an other DataSet clould be the solution to my problem too.
Regards, GD
I'm trying to iterate through a large table and change the value of a field. Using Edit & Post takes a long time.
Is there any significantly faster way to do it?
(I thought of something like writing directly to the recordbuffer.)
A fast way to populate a ClientDataSet without a provider with the data of an other DataSet clould be the solution to my problem too.
Regards, GD
ASKER
Hi Meikl,
I should've mentioned that I'm using Paradox tables.
Looks like I better tell the 'whole story': I need to reorder data in a ClientDataSet when the order is based on a lookupfield value. What I'm trying to do is duplicating some Fields on new fieldnames in the commantext of a BDEClientDatSet. This way I have fields with fieldkind of fkData, which are good for Indexes after the value of a lookupfield is copied into it. The problem is that with the normal way with Edit & Post it is very slow on large datasets.
An other way I've tried was fetching the Dataset to an other ClientDataSet through a DataSetProvider. It works fine for display purposes, but when the user changes the value of a field in the client which is a KeyField for a LooUpField in the Provider dataset, the 'looked up' value remains the same in the Client. Applying changes and Refreshing the client brings up the proper values, but on large datasets it's very slow again.
RefreshRecord should be the solution, but strangely enough, it does not refreshes the lookupfields ...
Regards, GD.
I should've mentioned that I'm using Paradox tables.
Looks like I better tell the 'whole story': I need to reorder data in a ClientDataSet when the order is based on a lookupfield value. What I'm trying to do is duplicating some Fields on new fieldnames in the commantext of a BDEClientDatSet. This way I have fields with fieldkind of fkData, which are good for Indexes after the value of a lookupfield is copied into it. The problem is that with the normal way with Edit & Post it is very slow on large datasets.
An other way I've tried was fetching the Dataset to an other ClientDataSet through a DataSetProvider. It works fine for display purposes, but when the user changes the value of a field in the client which is a KeyField for a LooUpField in the Provider dataset, the 'looked up' value remains the same in the Client. Applying changes and Refreshing the client brings up the proper values, but on large datasets it's very slow again.
RefreshRecord should be the solution, but strangely enough, it does not refreshes the lookupfields ...
Regards, GD.
nevertheless a query would be the fastest also on paradox-tables
in your case your update-statement looks like
update tablename set fieldname=(select fieldname from lookuptable where tablename.keyfield=lookupt able.keyfi eld)
just from head->means untested
meikl ;-)
in your case your update-statement looks like
update tablename set fieldname=(select fieldname from lookuptable where tablename.keyfield=lookupt
just from head->means untested
meikl ;-)
ASKER
As far as I know update works only on the phisical dataset, but in this case the fields which need to be changed exists only in the memory. Many times I whish Deplhi was able to run SQL on DataSets in the memory ...
Regards, GD.
Regards, GD.
oops, why not use calculated fields for this?
ASKER
Can Calculated fields be part of indexes? The problem is that a LookUp field has to be an indexfield as well.
>Can Calculated fields be part of indexes?
oh no
back to the roots,
you are talking about a clientdataset,
which has some additional non-physical fields,
supplied with a lookupresult-field and this
field is used as index, correct?
you want now to know, how to make the supplement
of the pseudo-field faster, right?
if so, no idea yet
meikl ;-)
oh no
back to the roots,
you are talking about a clientdataset,
which has some additional non-physical fields,
supplied with a lookupresult-field and this
field is used as index, correct?
you want now to know, how to make the supplement
of the pseudo-field faster, right?
if so, no idea yet
meikl ;-)
ASKER
"you want now to know, how to make the supplement
of the pseudo-field faster, right?
" - Yes that was the original Q about. I have checked the VCL source how Delphi implements posting. I'm begining to understand it, but right know I have no more time for 'decoding' the source. I hopped someone with more knowledge of VCL source could help me.
Thanx anyway, appreciate your time for trying to help me.
Regards, GD.
of the pseudo-field faster, right?
" - Yes that was the original Q about. I have checked the VCL source how Delphi implements posting. I'm begining to understand it, but right know I have no more time for 'decoding' the source. I hopped someone with more knowledge of VCL source could help me.
Thanx anyway, appreciate your time for trying to help me.
Regards, GD.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you have any controls attached to this data set, such as a DBGrid? DisableContols before doing any updates to the table..
Also there is a component you may want to look at called kbmMemTable http://www.components4developers.com/ its FREE and works great as a very fast temp table.. This may increase your performance.
Also there is a component you may want to look at called kbmMemTable http://www.components4developers.com/ its FREE and works great as a very fast temp table.. This may increase your performance.
goodday:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
update tabelename set fieldname=value where maybeconditions
use the execsql-method of the query to fire the statement
meikl ;-)