FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour May I have an sample for TProgress for Index
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
May I have an sample for TProgress for Index
Posted: Sat Sep 29, 2007 06:43 PM

Dear All,

I've used TMeter for index progress bar and it works in 16bits but I convert to 32bits now. I don't work properly. May I have an example for Index Progress Bar?

Thanks in advance,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
May I have an sample for TProgress for Index
Posted: Sat Sep 29, 2007 07:06 PM

Sorry, I don't have an example for an index progress bar.

But it looks strange to me that TMeter isn't working in 32-bit.

I converted a progress bar, using TMeter, from 16-bits to 32-bits too and it is working fine here.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: May I have an sample for TProgress for Index
Posted: Sat Sep 29, 2007 08:10 PM
This is a working sample:

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oMtr

    LOCAL nPos

    USE TEST

    DEFINE DIALOG oDlg

    @ 1, 1 METER oMtr VAR nPos TOTAL LASTREC();
           SIZE 100, 20

    @ 3, 1 BUTTON "Start";
           ACTION STARTINDEX( oMtr )

    ACTIVATE DIALOG oDlg;
             CENTER

    CLOSE

    RETURN NIL


STATIC FUNCTION STARTINDEX( oMtr )

    INDEX ON FIELD -> last + FIELD -> first TO MTRTEST EVAL ( oMtr:Set( RECNO() ), oMtr:Refresh(), .T. )

    MSGINFO( "Done!" )

    RETURN NIL


EMG
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
May I have an sample for TProgress for Index
Posted: Wed Oct 03, 2007 05:34 PM

Dear Enrico,

Your sample is working as my 16 bits but the difference is RDD but when I use ADS, the index run fine but the Meter is not working.

I use xHarbour.com + FWH7.07 + ADS and it seem the EVAL and EVERY is working properly for ADS.

Thanks,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
May I have an sample for TProgress for Index
Posted: Wed Oct 03, 2007 06:25 PM

Dutch,

You can't use functions in ADS indexes. ADS is client/server and the server cannot evaluate a function that is inside the client program.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
May I have an sample for TProgress for Index
Posted: Wed Oct 03, 2007 06:57 PM

Dear James,

Thank you very much for kick a mountain out of my head. I waste two days for fixing it.

Regards,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
May I have an sample for TProgress for Index
Posted: Fri Oct 05, 2007 03:43 AM
Dutch, to show progress meter while indexing via RDDADS, use something similar to the following:
FUNCtion CreateIndex( aNtxKey )

     LOCAL nCnt, lUnique

     #define ADS_ABORT    .t.
     #define ADS_CONTINUE .f.
     oNtxMeter:nTotal:=100 //LastRec()
     ADSRegCallBack({|nPercent| progress(nPercent,cNtxName)})

     FOR nCnt := 1 TO LEN( aNtxKey )

         cNtxKey  := aNtxKey[ nCnt, 1 ]
         cNtxName := aNtxKey[ nCnt, 2 ]
         cNtxFor := ""
         if len(aNtxKey[nCnt]) > 3
            cNtxFor := aNtxKey[ nCnt, 4 ]
         endif
         lUnique  := if( LEN( aNtxKey[ nCnt ] ) > 2, aNtxKey[ nCnt, 3 ], FALSE  )
         oSayText:bGet := { || "Re-building ... " + UPPER( cNtxName ) + ".NTX" }
         oSayText:Refresh()
         oNtxMeter:Set(0)
         oNtxMeter:display()

         CursorWait()

         IF lUnique
            /*
            if lExclDel
             INDEX ON &( cNtxKey ) TO ( cNtxName )  UNIQUE for !deleted() ;
                EVAL ( oNtxMeter:Set( Recno() ), SysRefresh(), .T. )
            else
            */
             INDEX ON &( cNtxKey ) TO ( cNtxName )  UNIQUE
                //EVAL ( oNtxMeter:Set( Recno() ), SysRefresh(), .T. )
                // ADS doesn't recognize eval..every
            *endif
         ELSE
            if empty(cNtxFor)
               INDEX ON &( cNtxKey ) TO ( cNtxName )
                 //EVAL ( oNtxMeter:Set( Recno() ), SysRefresh(), .T. )
            else
               INDEX ON &( cNtxKey ) TO ( cNtxName ) for &(cNtxFor)
                //EVAL ( oNtxMeter:Set( Recno() ), SysRefresh(), .T. )
            endif
         ENDIF
     NEXT
     ADSClrCallBack()
RETURN (Nil)
//-------------------------------------------------------------------------
static function progress(nPercent,CurrentNtx)
  static cNtx
  if cNtx==nil
     cNtx := ""
  endif
  if empty(cNtx)
     cNtx := currentNtx
  elseif cNtx != CurrentNtx
     cNtx := currentNtx
     oNtxMeter:Set(100)
     oNtxMeter:display()
  endif

  oNtxMeter:Set( nPercent )
  oNtxMeter:display()
return ADS_CONTINUE
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 59
Joined: Thu May 17, 2007 08:27 AM
May I have an sample for TProgress for Index
Posted: Fri Oct 05, 2007 03:37 PM

Hi hua:

Great !!

It work for ADS RDD .

Best Regards

kokoo

-------------

best regards

kokoo Kao
Posts: 840
Joined: Thu Oct 13, 2005 07:05 PM
May I have an sample for TProgress for Index
Posted: Fri Oct 05, 2007 03:50 PM

That's the way it works !!!!!

Why ?.... well, the explanation is very simple, ADS server does the indexing, not your program, this means that INDEX ON just send the indexing order to the server and then the server takes care of performing the operation, so your program will never know the status of the indexing progress, since you don't have a way of "asking" the ADS server the percentage of advance.

AdsClrCallBack() does a "call back" to the server, this means that the server will give your application an "status" of the currently running process.

The "call back" is only available for indexing, not for running queries (ADS does SQL queries and they are damn fast), or setting AOF() or Scopes.

Saludos

R.F.
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
May I have an sample for TProgress for Index
Posted: Fri Oct 05, 2007 05:24 PM

Thanks Hua&Rene&James,

It works well for ADS.

Regards,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)

Continue the discussion