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:
and in the GETPROGRES i'm doing a:
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..
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);
PHP Code:
vvUtility_getSessVar('PROGRESS':progressMsg:vvSessid);
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(fp, o) {
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 f = 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 data= Ext.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/100, Math.round(data.progress)+'% completed', data.msg);
}
} else {
Ext.MessageBox.hide();
Ext.Msg.show({
title:'Error',
message: data.msg,
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
}
},
failure: function(response, opts) {
console.log('ajax request failed' + response.status);
}
});
};
};
for(var i = 1; i < 13; i++){
console.log(i);
setTimeout(f(i), i*500);
}
},
failure: function(fp, o) {
Ext.Msg.show({
title: 'Failure',
msg: 'File upload failed. See Error log for more information.',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
}
});
}
Comment