Bob:

Hello.  I too had a routine that takes a while to process (it has 6
different stages in summarizing data since the end-user need to see various
analytical reports).  I also, wanted to inform the user of the routine's
progress.

I'm using RBWin65++ (But the concept might work with the DOS versions as
well).

First, most people on the list already have, you'll need a dummy
table(VarForm).  It really only needs 1 column.  We use this dummy table for
variable forms which our "Report Setup Forms" are driven from.

Insert a mininum of 2 records (you'll see why later).

Create a form (ReportSetup) and use the dummy table as the bound table.
        In the form:
                Place variable(s) for each of your prompts to the user
                Place a variable for (each of) your progress message
                Place a button that will start the processing (which runs Process.rcf)


Create a command file (Setup.rcf)
<------------------------------------
        --Initialize
        SET VAR vctSearch       TEXT = NULL  --On Form
        SET VAR vctProgressMsg  TEXT = NULL      --On Form

        --Get Search parameters and display form
        EDIT USING ReportSetup +
        WHERE LIMIT = 2

        --Clean-Up
        CLEAR VAR vctSearch
        CLEAR VAR vctProgressMsg
------------------------------------>

Create a command file (Process.rcf)
<------------------------------------
        --Initialize
        SET VAR vgtToggle       TEXT = 'NEXTROW'
        SET VAR vctProgressMsg  TEXT = NULL
        SET VAR vciTotalRecords INTEGER = 0
        SET VAR vciRecordCount  INTEGER = 0

        --<pseudo-code>
        --<Place code that will:
        --validate user responses and build appropriate
        --select statement and declare a cursor
        --capturing number of records to process(vciTotalRecords), etc.>
        --
        --Note: this works great for my need since I'm inserting
        --calculated variables to temporary tables for my reports record by record.

        FETCH curMyCursor INTO <vctMyVariables>

        WHILE SQLCODE <> 100 THEN
                SET VAR vciRecordCount = (.vciRecordCount + 1)

                -- Build progress message
                SET VAR vctProgressMsg = +
                ('Processing' & (CTXT(.vciRecordCount)) & 'of' & 
(CTXT(.vciTotalRecords)))

                -- Display/update progress message on form
                &vgtToggle

                -- Flip toggle command
                IF vgtToggle = 'NEXTROW' THEN
                        SET VAR vgtToggle = 'PREVROW'
                ELSE
                        SET VAR vgtToggle = 'NEXTROW'
                ENDIF

                --<<Process>>
                --<<INSERT INTO tmpTable>>

                FETCH curMyCursor INTO <vctMyVariables>
        ENDWHILE

        DROP curMyCursor

        --Clean-Up
        CLEAR VAR vgtToggle
        CLEAR VAR vciTotalRecords
        CLEAR VAR vciRecordCount
------------------------------------>

The &variable is a God-send for this trick.  I have tried, RECALC VARIABLES,
RECALC TABLES before than I couldn't get the results the wanted.

Sure there is a hit on performance, but, I'll take the hit to give the user
a perception that the routine IS INDEED working, to make the user stop
thinking that the machine is locked up and leave the <CTRL-ALT-DEL> alone.
:)


Regards,

Rommel




-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Bob Thompson
Sent: Thursday, June 13, 2002 10:00 AM
To: Rbase-L (E-mail)
Subject: Another novice form question


I want to display a "count down" counter
on a form while the app is processing a
somewhat large data set.  I have a push button
on the form that executes the program and
I want the form to display something like :
  "Processing record# 20 of 10000"

This app may take 1-2 minutes to completely
execute and this is feed back to the user.

I have tried the SCREEN RESTORE, WRITE
and RECALC commands, but cannot get the
form to show updated variables until the procedure
has finished. (It is then a moot point of course!)
 I do not want to use the FEEDBACK option as
 I would like more control over what and
how the counter is displayed.

You all have been very helpful and I appreciate
the assistance.   Again, simply how do you
get a variable to redisplay at will on a form
while you are performing a WHILE LOOP or
DECLARE CURSOR ?

Thanks.

================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/

================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/

Reply via email to