on 01-25-2016 10:54 AM
Hi Personas Experts,
i have created a script that runs 5 times through the same transaction.
One run of the transaktion (in the backend) takes about 2 minutes.
If i start the script it workes fine but in the browser is no hourglass symbol.
It looks like a browser crash although the script is working correct.
Then i created 5 text labels and tried to put the 5 "ready messages" from the status bar after each run in one text label.
This works although fine but the messages do not appear until the whole script is complete. I want to give a status on the screen while the script is running.
Now, I have two questions:
1. Is there any possibility to bring an hourglass symbol or a progress bar in the foreground while a script is running ?
2. How can i update my screen or my text labels while a script is running ?
Thx! Thomas
Hi,
As Sushant hat mentioned there is now an internal discussion going on if and how the loading animation can be kept going during long-running scripts.
For your second question regarding the ability of updating labels synchonously while a script is running, even directly manipulating the the html DOM will not work.
Cheers,
Clemens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Thomas,
Yes, I got that wrong. I realized that even directly manipulating the DOM won't update the screen until the current event is processed, that is until the current script is finished. I don't think there is any way to make the browser update its UI during the current event processing. That's why I changed my earlier post.
The only way I see is to split your script into logical blocks and let these blocks be processed asynchonously using sap.personas.scripting.executeScriptInternal() and timeout().
Here's an example:
var taskStrings = ["first step", "second step", "third step"];
var index =0;
var text ="";
function doTask(){
// 3s pause
var time = (new Date()).getTime() +3000;
debugger;
while ((new Date()).getTime() < time );
//update the UI
text += taskStrings[index]+ " completed.\n";
session.findById("wnd[0]/usr/wlblPersonas_1453929017141").text =text;
sap.personas.scripting.executeScriptInternal( {src:""}); // executes and empty script AND then refreshes the screen
// schedule the next task
if (++index < taskStrings.length){
setTimeout(doTask,500); // the 500ms delay is needed to allow the screen update thread to get scheduled
}
}
session.findById("wnd[0]/usr/wlblPersonas_1453929017141").text = "";
setTimeout(doTask,100);
Hope this helps,
Clemens
You can try including third party library for busy indicator like spin.js and manipulate the DOM elements to add it (eg: to UserArea).
For details on including JS library, you can refer to KB article here (Scripting: Including Global Javascript Libraries - SAP Imagineering - SCN Wiki).
-Chinthan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well Currently NO.
But your post has triggered discussions internally.
Coming to your script, 2 minutes is a lot of time. Is your approach the only solution?
Sushant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
2 minutes ist the time that the transaction takes in the backend. With smaller clients it could be faster (one Minute or less)
This ist basically no problem because it is only needed once by the turn of the year.
But it's a really nice scenario for a personas script because there are many runs with different Input Parameters. Today the end user needs a documentation. With Personas the whole scenario can be done with one klick
Thomas
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.