RECORDS( MFL:Key0 ) doesn't return correct record number 
Author Message
 RECORDS( MFL:Key0 ) doesn't return correct record number

A Btrieve defined as following.

MyFile    FILE,DRIVER('BTRIEVE'),PRE(MFL),CREATE,BINDABLE,THREAD,NAME
('MyFile.dat')
Key0        KEY(MFL:Field1,MFL:Field2),DUP,NOCASE,OPT
Record      RECORD,PRE()
TrxnID        GROUP
Field1          STRING(6)
Field2          LONG
              END
...
            END
          END

Please see the following paragraph of code.

  ?ProgressBar{PROP:RangeHigh} = RECORDS( MFL:Key0 )  ! will be about
9000

  Progress = 0
  CLEAR( MFL:Record )
  SET( MFL:Key0, MFL:Key0 )
  LOOP
    NEXT( MyFile )
    IF ERRORCODE()
      BREAK
    END
    Progress += 1
    ! Some work is done here
    ! but MyFile's fields buffer is not changed
  END

At last variable Progress will be about 23000.

Why doesn't RECORDS( MFL:Key0 ) return the correct record number?

And I cannot display the processing progress correctly because when
variable Progress reach around 9000, the progress bar will reach 100%.
And during processing of the records after 9000, the display will stop
at 100%.  It will be strange for the user when it reaches 100% but
doesn't stop and still working.

Thanks!
Ming Zhu

Sent via Deja.com
http://www.*-*-*.com/



Mon, 02 Jun 2003 18:48:57 GMT  
 RECORDS( MFL:Key0 ) doesn't return correct record number
Hi Ming,
Try this
  SET(ref:keysupplier,0)
  ?ProgressBar{PROP:rangehigh} = RECORDS(ref:keysupplier)
  ?ProgressBar{PROP:progress} = 0
  SET(ref:keysupplier,0)
  LOOP UNTIL EOF(ref:keysupplier)
     NEXT(ref:keysupplier)
     ?ProgressBar{PROP:progress} = ?ProgressBar{PROP:progress} + 1
     DISPLAY()
  END
Hope this helps
John
Quote:

> A Btrieve defined as following.

> MyFile    FILE,DRIVER('BTRIEVE'),PRE(MFL),CREATE,BINDABLE,THREAD,NAME
> ('MyFile.dat')
> Key0        KEY(MFL:Field1,MFL:Field2),DUP,NOCASE,OPT
> Record      RECORD,PRE()
> TrxnID        GROUP
> Field1          STRING(6)
> Field2          LONG
>               END
> ...
>             END
>           END

> Please see the following paragraph of code.

>   ?ProgressBar{PROP:RangeHigh} = RECORDS( MFL:Key0 )  ! will be about
> 9000

>   Progress = 0
>   CLEAR( MFL:Record )
>   SET( MFL:Key0, MFL:Key0 )
>   LOOP
>     NEXT( MyFile )
>     IF ERRORCODE()
>       BREAK
>     END
>     Progress += 1
>     ! Some work is done here
>     ! but MyFile's fields buffer is not changed
>   END

> At last variable Progress will be about 23000.

> Why doesn't RECORDS( MFL:Key0 ) return the correct record number?

> And I cannot display the processing progress correctly because when
> variable Progress reach around 9000, the progress bar will reach 100%.
> And during processing of the records after 9000, the display will stop
> at 100%.  It will be strange for the user when it reaches 100% but
> doesn't stop and still working.

> Thanks!
> Ming Zhu

> Sent via Deja.com
> http://www.deja.com/



Mon, 02 Jun 2003 19:21:52 GMT  
 RECORDS( MFL:Key0 ) doesn't return correct record number


Quote:
> Hi Ming,
> Try this
>   SET(ref:keysupplier,0)
>   ?ProgressBar{PROP:rangehigh} = RECORDS(ref:keysupplier)
>   ?ProgressBar{PROP:progress} = 0
>   SET(ref:keysupplier,0)
>   LOOP UNTIL EOF(ref:keysupplier)
>      NEXT(ref:keysupplier)
>      ?ProgressBar{PROP:progress} = ?ProgressBar{PROP:progress} + 1
>      DISPLAY()
>   END
> Hope this helps
> John

Sorry, it doesn't work.  SET( Key, 0 ) doesn't help.  The result is
still the same.

Somebody else says Records(key) is going to give you the number of
unique values in the key.  After I tried it, I found it's correct.  So
I now use RECORDS(MyFile) instead to get the record number I want.

Thanks!
Ming Zhu

Sent via Deja.com
http://www.deja.com/



Tue, 03 Jun 2003 11:57:03 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. process doesn't always get all the records

2. seek doesn't reposition record pointer

3. return -code return doesn't play nice with set

4. Correct Template for Record Processes?

5. Browse cursor does not select correct record

6. Convert comma-delimited records to fixed length records

7. Deleting current record based on next record

8. Records Disappeared/Added to the prior Record No

9. Records with a record # of zero problem

10. Prime record fields on insert - Before adding auto incremented record

11. C5EEa - Record Not Available(33) when deleting a record

12. Add Child Record Within New Parent Record form.

 

 
Powered by phpBB® Forum Software