• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

trouble with vvUtility_getSessVar or is it a bug?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • trouble with vvUtility_getSessVar or is it a bug?

    I'm writing an app to do an upload from an Excel -sheet, in order to get in converted into the correct layout for transfering data in our finance application.

    after the upload, i want to show progress messages to the user,

    After my upload (with submit) from the Xls, i launch an Rpg-program (FISUPLOAD) and after the success from the upload i also launch Ajax-calls in to know get the state of the progress.. with this ajax call i call another RPG (GETPROGRES)..

    in the first FISUPLOAD i'm setting the progress by:

    PHP Code:
      vvUtility_saveSessVar(
                
    'PROGRESS':
                
    OC
                 
    +DQ+'success' +DQ+COLON +%trim(successText)         +COMMA
                 
    +DQ+'msg'     +DQ+COLON +DQ+%trim(messagetext)+DQ   +COMMA
                 
    +DQ+'progress'+DQ+COLON +%trim(%editc(percent:'Z'))
              + 
    CC:
                
    vvSessId); 
    and in the GETPROGRES i'm doing a:
    PHP Code:
     vvUtility_getSessVar('PROGRESS':progressMsg:vvSessid); 
    however the progressMsg in the latter is always blank..
    i can see the progress directly in the VVSESSVAR-file, and also when i do logging, i see that my sessid is also correct... nevertheless the value remains blank..

    In my js-program i now do the Ajax-call, with a setTimeout.. i'm pretty sure this is not the right way, can you also assist on what the best way is to launch Ajax-calls for getting a progress-state... ?? thx in advance..


    PHP Code:
    if (uploadForm.isValid()) {
        
    uploadForm.submit({
            
    url'/valence/vvupload.pgm',
            
    waitMsg'Uploading file...',
            
    success: function(fpo) {
                
    Valence.util.msg('File upload'o.result.msg,2000);
                
    Ext.MessageBox.show({
                    
    title'Please wait',
                    
    msg'Uploading to FIS...',
                    
    progressText'Initializing...',
                    
    width:300,
                    
    progress:true,
                    
    closable:false,
                    
    animateTarget'uploadbtn'
                
    });

                var 
    = function(v){
                    return function(){
                        
    console.log('Calling Ajax Request : ' +v);
                        
    Ext.Ajax.request({
                            
    url'vvcall.pgm',
                            
    params: {
                                
    pgm'GETPROGRES',
                                
    action'getProgress'
                            
    },
                            
    success: function(response) {
                                if (
    response.responseText) {
                                    var 
    dataExt.util.JSON.decode(response.responseText);
                                    
                                    if (
    data.success) {
                                        if (
    data.progress>=99) {
                                            
    Ext.MessageBox.hide();
                                            
    Ext.example.msg('Done''Data was uploaded to FIS!');
                                        } else {
                                            
    Ext.MessageBox.updateProgress(data.progress/100Math.round(data.progress)+'% completed'data.msg);
                                        }
                                    } else {
                                        
    Ext.MessageBox.hide();
                                        
    Ext.Msg.show({
                                            
    title:'Error',
                                            
    messagedata.msg,
                                            
    iconExt.Msg.ERROR,
                                            
    buttonsExt.Msg.OK
                                        
    });
                                    }
                                }
                            },
                            
    failure: function(responseopts) {
                                
    console.log('ajax request failed' response.status);
                            }
                        });
                    };
                };
                for(var 
    113i++){
                    
    console.log(i);
                    
    setTimeout(f(i), i*500);
                }



            },
            
    failure: function(fpo) {
                
    Ext.Msg.show({
                    
    title'Failure',
                    
    msg'File upload failed. See Error log for more information.',
                    
    buttonsExt.Msg.OK,
                    
    iconExt.MessageBox.ERROR
                
    });
            }
        });


  • #2
    I think the issue is simple - the vvUtility_getSessVar returns a value, but you're not receiving it.

    Try this instead:
    ProgressMsg = vvUtility_getSessVar('PROGRESS':vvSessid);

    Comment


    • #3
      hi Robert..

      now i noticed.. stupid of me...

      My other problem i've asked ...could you still help me on the way on how the best practice is for sending Ajax- calls to get the progress

      i've now (taken from an example) the setTimeout in a for-loop from 1 to 13...
      how can i launch the ajax-requests, and let them stop depending on the progress-state?

      Code:
      for(var i = 1; i < 13; i++){ 
                      console.log(i); 
                      setTimeout(f(i), i*500); 
                  }

      Comment


      • #4
        For your progress bar, instead of having a for loop submit function "f" 13 times, I would suggest you replace that with a single call to function "f", and then in your Ajax 'success' clause if progress<99 then do the setTimeout to submit "f" again after a short delay. You probably don't need that "return function()" line either.

        Comment

        Working...
        X