1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Why async task not working sometimes in progress?

Discussão em 'StackOverflow' iniciado por fdantas, Agosto 6, 2019.

  1. fdantas

    fdantas Administrator Moderador

    I have written a query for using async call. If its not finished in theback end then i could get "not yet completed" messages as its says still back end process is not completed. In the back end its calling some program(sync method) . So these all activities are happens using one button. The issue here is some times wont give "not completed messages" once i click the buttons instead browser went not responding(means some process happening in the back end) and back to normal once finished.

    Note - whenever i call back end program(Getdata.p) it has some big data's on db so it must take 10 or 20 sec to complete the purpose of it.

    DEFINE INPUT PARAMETER dProcessObj AS DECIMAL NO-UNDO.

    DEFINE VARIABLE lError AS LOGICAL INIT FALSE.
    DEFINE VARIABLE cError AS CHARACTER INIT ''.
    DEFINE VARIABLE hProcess AS HANDLE NO-UNDO.
    DEFINE VARIABLE hAppServer AS HANDLE NO-UNDO.
    DEFINE VARIABLE hAsynCall AS HANDLE NO-UNDO.
    DEFINE VARIABLE iTotal AS INTEGER NO-UNDO INIT 0.
    DEFINE VARIABLE hCall AS HANDLE NO-UNDO.
    DEFINE VARIABLE I AS INTEGER NO-UNDO.
    DEFINE VARIABLE CallProgram AS CHARACTER NO-UNDO INIT "GetData.p".
    /* gshAstraAppserver - Appserver */
    IF VALID-HANDLE(gshAstraAppserver) = FALSE THEN DO:
    MESSAGE "No server connected.." VIEW-AS ALERT-BOX.
    RETURN.
    END.
    PROCESS EVENTS.
    RUN VALUE(CallProgram) ON SERVER gshAstraAppserver ASYNCHRONOUS
    SET hAsynCall (INPUT dProcessObj,
    OUTPUT opcReturnValue) NO-ERROR.
    IF ERROR-STATUS:ERROR OR hAsynCall:STOP OR hAsynCall:ERROR THEN DO:
    MESSAGE ERROR-STATUS:GET-MESSAGE(1).
    END.

    DO WHILE NOT hAsynCall :COMPLETE ON ERROR UNDO, RETURN:
    PROCESS EVENTS.
    IF NOT hAsynCall :COMPLETE THEN DO:
    MESSAGE 'Not Yet Completed'.
    END.
    END.
    IF ERROR-STATUS:ERROR THEN DO:
    MESSAGE ERROR-STATUS:GET-MESSAGE(1).
    END.

    DELETE OBJECT hAsynCall NO-ERROR.
    IF ERROR-STATUS:ERROR THEN DO:
    MESSAGE ERROR-STATUS:GET-MESSAGE(1).
    END.



    I don't know how can i write a sample program for this. sorry for the convenience. Great answers welcome here

    Continue reading...

Compartilhe esta Página