cancel
Showing results for 
Search instead for 
Did you mean: 

No hourglass symbol / progress Bar - Screen Personas 3.0 SP1

Thomas_Mangler
Active Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

clemens_gantert
Active Participant
0 Kudos

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

Thomas_Mangler
Active Participant
0 Kudos

Hi Clemens,

i had no luck with directly manipulation the DOM.

I am missing a command like "refresh Screen" in the Personas scripting.

Thomas

clemens_gantert
Active Participant
0 Kudos

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

Thomas_Mangler
Active Participant
0 Kudos

Thx a lot,

i will check it when i'm back in office in 3 Weeks

Thomas

Thomas_Mangler
Active Participant
0 Kudos

Hello Clemens,

this solution works very well. Thank you again.

I needed some time because i had other projects and i'm new in working with JavaScript.

Perhaps there will be a solution to keep the loading animation in future SP releases.

Thomas

Answers (2)

Answers (2)

chinthan_yajamaan
Active Contributor
0 Kudos

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

0 Kudos

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

Thomas_Mangler
Active Participant
0 Kudos

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