Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread RecNo and Progressing
Fri, Apr 16 2010 5:30 AMPermanent Link

durumdara

Hi!

We used the RecNo as "Local DataSet's position" in our programmes.

For example: we have a procedure:

CopyWithProgress(SrcDS, DesDS, ProgressFrm, HowManyRecords, FromFirst)

This is commonly used to copy the DS but with Progress to see where we are actually, and how many records are remaining.

This was totally defected with EDB (RecNo = 0). Ok, I can determine the "Delta" when I used "FromFirst", but if I want to copy records from the special position, I don't know, where I'm.

RecNo helped to me with DBISAM, when RecordCount was 100, and I'm in 60 then 40 remaining on progress.

But without RecNo I have only way to know, where I'm in DataSet when I do "while not Eof do inc(c) ;Next; - but this is uneffective - because the Record Fetching have biggest time...

There is some way to determine in EDB, where I'm in DataSet?

Thanks:
  dd
Fri, Apr 16 2010 10:31 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

durumdara


Is there any reason you can't use a simple counter and increment each loop?

If, as it looks from the bit of code you supplied you're copying a record (all or part) from tableA to tableB I'd suggest checking out SQL. Use a query with an attached progress event. 1) it will be faster and 2) you get your progress info.

Roy Lambert [Team Elevate]
Mon, Apr 19 2010 6:10 AMPermanent Link

durumdara

<<<Roy Lambert wrote:
durumdara
Is there any reason you can't use a simple counter and increment each loop?
If, as it looks from the bit of code you supplied you're copying a record (all or part) from tableA to tableB I'd suggest checking out SQL. Use a query with an attached progress event. 1) it will be faster and 2) you get your progress info.>>>

Dear Roy!

1.)
I used RecNo in common "DataSetTools" unit - that can do many things with DataSets.
(Prev. I have problem only with RecordCount, because IB/FB cannot count the records are not fetched locally. But now I'm out from IB/FB world so this is not disturbing me).
The counter is not problem, when I copy ALL RECORDS. But sometimes I need to copy only some part of the DataSet, for example the user is determine that he/she needs only half of the data, and positioning to 50. record. And he/she tells the program: copy all after this.
If I have RecNo, I can say that "I'm in 50. record, and count is 100" - so I can use the progress.

2.)
I cannot use Query because:
These operations I spoken about are meaning "Session to Another Session" copies.
I copy DataSet with ALL FIELDS (not only fkData) to Local Session.

Why?
Because we have an intelligent grid that can order the datas by every column. On each fields: calc/lookup.
The user cannot understand what is "calc field" he/she don't understand that "we can't sort on this column, because it is calculated/lookup".
So we need to copy all data between the two sessions (Remote to Local).
Luckily these operations in 99% are "COPY ALL" operations, so I need the RecNo trick in the 1%.
But if big amount of data I have, I have big cost to determine the actual row number with two whilenoteof cycle (first: determine; next: copy)...

That was the meaning of my question.

Thanks for your help:
  dd
Mon, Apr 19 2010 6:38 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

durumdara

>I used RecNo in common "DataSetTools" unit - that can do many things with DataSets.
>(Prev. I have problem only with RecordCount, because IB/FB cannot count the records are not fetched locally. But now I'm out from IB/FB world so this is not disturbing me).
>The counter is not problem, when I copy ALL RECORDS. But sometimes I need to copy only some part of the DataSet, for example the user is determine that he/she needs only half of the data, and positioning to 50. record. And he/she tells the program: copy all after this.
>If I have RecNo, I can say that "I'm in 50. record, and count is 100" - so I can use the progress.

This makes me think you're using RecNo as the primary key for the table and that just isn't possible with ElevateDB

>I cannot use Query because:
>These operations I spoken about are meaning "Session to Another Session" copies.
>I copy DataSet with ALL FIELDS (not only fkData) to Local Session.
>
>Why?
>Because we have an intelligent grid that can order the datas by every column. On each fields: calc/lookup.
>The user cannot understand what is "calc field" he/she don't understand that "we can't sort on this column, because it is calculated/lookup".
>So we need to copy all data between the two sessions (Remote to Local).
>Luckily these operations in 99% are "COPY ALL" operations, so I need the RecNo trick in the 1%.
>But if big amount of data I have, I have big cost to determine the actual row number with two whilenoteof cycle (first: determine; next: copy)...

Unless the grid you're using does something really weird the only way you get the sorting you mention is to load all the data you want into the grid in which case the local table is redundant. I used to use a load of memory tables and a standard dbgrid but now I simply populate a TAdvStringGrid. You need to include the primary key in a hidden column and handle updates yourself but it makes for a faster system.

Roy Lambert
Image