B
Bharat
Guest
I am using below query for progress completion which shows how much percentage is completed in record updating process. My question or doubt here is Is it possible to provide estimated hrs/minutes for this progress completion?
For example, consider a table has 1000 records and each record gets into some validations before updating and approx time is less than a second(milliseconds). So if a single record takes less than a millisecond to update after gets to validations then what will be estimated for 1000 records? How to calculate and convert into hh:mm:ss? Please help to write a sample query.
Continue reading...
For example, consider a table has 1000 records and each record gets into some validations before updating and approx time is less than a second(milliseconds). So if a single record takes less than a millisecond to update after gets to validations then what will be estimated for 1000 records? How to calculate and convert into hh:mm:ss? Please help to write a sample query.
Code:
DEFINE VARIABLE I AS INTEGER NO-UNDO.
DEFINE VARIABLE iPercentage AS INTEGER NO-UNDO.
DEFINE VARIABLE iComp AS INTEGER NO-UNDO.
DEFINE VARIABLE iRec AS INTEGER NO-UNDO.
ASSIGN
I = 0
iComp = 0
iRec = 0
iPercentage = 0.
/* Calculating Total records*/
FOR EACH <table> NO-LOCK:
iRec = iRec + 1.
END.
/* Taking each records from the same table to update*/
FOR EACH <table> NO-LOCK:
I = I + 1.
IF I = 1 THEN DO:
/*do some more validations*/
iComp = iComp + I.
iPercentage = 100 * (iComp / iRec).
IF iPercentage = 100 THEN DO:
MESSAGE "Record Updation Is completed".
END.
ELSE DO:
I = 0
NEXT.
END.
END.
END.
Continue reading...