Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Faster ...

Posted on 2002-07-16
11
277 Views
Last Modified: 2010-05-18
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
0
Comment
Question by:goodday
11 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7156511
use a query with an update-statement like

update tabelename set fieldname=value where maybeconditions

use the execsql-method of the query to fire the statement

meikl ;-)
0
 

Author Comment

by:goodday
ID: 7156692
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.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7156703
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=lookuptable.keyfield)

just from head->means untested

meikl ;-)
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:goodday
ID: 7156712
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.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7156722
oops, why not use calculated fields for this?
0
 

Author Comment

by:goodday
ID: 7156726
Can Calculated fields be part of indexes? The problem is that a LookUp field has to be an indexfield as well.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7156735
>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 ;-)
0
 

Author Comment

by:goodday
ID: 7156746
"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.  
0
 
LVL 7

Accepted Solution

by:
Cynna earned 300 total points
ID: 7156767
> RefreshRecord should be the solution, but strangely enough, it does not refreshes the lookupfields

Well, than my comment at http://www.experts-exchange.com/delphi/Q_20323187.html might help you out...
0
 

Expert Comment

by:Lazybones
ID: 7271410
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.
0
 

Expert Comment

by:CleanupPing
ID: 9343056
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.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question