cancel
Showing results for 
Search instead for 
Did you mean: 

how to keep a progress bar

Former Member
0 Kudos

Hi all,

I want to keep a progress bar to my views on each action.How to keep that??

Can anyone plz help me out

Regards

Padma N

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

A progress bar has 3 main properties namely

1) barcolor -which will decide color of progressbar.

create a context say ctx_barcolor of ProgressIndicatorBarColor type

which u can find in com.sap.ide.webdynpro.uielementdefinitions

2) percentvalue -This will decide the curent length of indicator.

This should be an integer say ctx_prcnt.

3) displayvalue -This will decide which value u want to display in ur progress bar.

This should be a String.For instance say ctx_dispval.

Now suppose I want to set my progress bar to 80% and say of green color.

Then first of all I will set percentvalue property.

wdContext.currentcontextelement.setCtx_prcnt(80);

Then I will set barcolor property.

wdContext.currentContextElement().setCtx_barcolor(WDProgressIndicatorBarColor.POSITIVE);

And finally I will set displayvalue property.


 wdContext.currentContextElement().setCtx_dispval(wdContext.currentContextElement().getCtx_va_prcnt()+"%"); 

Collectivelly


wdContext.currentcontextelement.setCtx_prcnt(80);

wdContext.currentContextElement().setCtx_barcolor(WDProgressIndicatorBarColor.POSITIVE);

 wdContext.currentContextElement().setCtx_dispval(wdContext.currentContextElement().getCtx_va_prcnt()+"%"); 

I hope this helps

Regards

Surender Dahiya

Former Member
0 Kudos

Hi Surender ,

I want this progress bar to get progresses from 0% to 100% means it has to show that the data is getting processed for every action in my view.

Its not that i have to fill color upto 80% initially.

Initillay it should be white in color.

On click of button progress bar has to show the progress from 0 to 100 to show that the transaction is being processed at tht back end.

Here onclick of submit button it has to fetch data from SAP and navigates to anotherview which has a table of SAP data that came from the back end.

After clciking of button and before displaying the next resultant view i want the progress bar to work

Regards

Padma N

Former Member
0 Kudos

Hi

See on click of button if u want to enable ur progress bar then do one thing create a method in which set the above all three properties to some different value say.

i created a method mprogressbar(int x)

and i wrote the code like

u have only 4 color values to choose from neutral,critical,negative,positive.

On value of x i want to change my progressbar


mprogressbar(int x)
{
if(x==1)
{
wdcontext.currentContextelement.setctx_barcolor(WDProgressIndicatorBarColor.neutral);
wdcontext.currentContextelement.setctx_prcnt(25);
wdcontext.currentContextelement.setctx_dispval(wdcontext.currentContextelement.getctx_prcnt()+"%");
}

if(x==2)
{
wdcontext.currentContextelement.setctx_barcolor(WDProgressIndicatorBarColor.critical);
wdcontext.currentContextelement.setctx_prcnt(50);
wdcontext.currentContextelement.setctx_dispval(wdcontext.currentContextelement.getctx_prcnt()+"%");
}

if(x==3)
{
wdcontext.currentContextelement.setctx_barcolor(WDProgressIndicatorBarColor.negative);
wdcontext.currentContextelement.setctx_prcnt(75);
wdcontext.currentContextelement.setctx_dispval(wdcontext.currentContextelement.getctx_prcnt()+"%");
}

if(x==4)
{
wdcontext.currentContextelement.setctx_barcolor(WDProgressIndicatorBarColor.positive);
wdcontext.currentContextelement.setctx_prcnt(100);
wdcontext.currentContextelement.setctx_dispval(wdcontext.currentContextelement.getctx_prcnt()+"%");
}

}

and i want for every 3 seconds the progress bar should move.

then create a TimedTrigger UI element and set the delay of 3 seconds there

and call the above function in OnAction.

create a conext say ctx_enable of boolean type and assign it to this time trigger.Initially set it to false in init() and then on click of ur button set it to true and say when ur progress bar reaches 100 make it false.

I hope this clears ur all doubt.

Regards

Surender Dahiya

Former Member
0 Kudos

Hi,

On click of Submit already i have a method to fetch data from SAP.Then where to bind this method.

What are these X values ?

Generally it has to move forward to show the status of the transaction.Once the transaction is completed and is ready to show the result it has to show 100%

Regards

Padma N

Former Member
0 Kudos

Hi

create a timed trigger element and in on action of this element call mprogressbar() method.Put a delay of say 2 seconds in delay property of timed trigger element .create a context variable of boolean type say ctx_enable and bind that to enable property of timed trigger element and in init() set this context variable to false.

On click of ur submit button set ctx_enable(true);

See u must have a notification which will notify that the transaction is complete on that notification u must set ur progress bar to 100%.So in mprogressbar() method U must use some conditions which will indicate the progress of ur transaction(start - end).On that progress u need to set attributes of progress bar.Once transaction is completed progress bar to 100%.

And that x is just a dummy variable which i used to explain u the whole concept.

I hope this clears ur all doubt.PLEASE provide points if helpful.

Regards

Surender Dahiya

Former Member
0 Kudos

Hi Surender,

how to know the progress of my background transaction?i mean whether it is 10 % completed or 50% completed??I know the status of the background transaction then i can show the status of the progress bar as 10% 50% etc.

Regards

Padma N

Former Member
0 Kudos

Hi,

I dont think so there is any way go get the status of ur transaction.Suppose ur transaction on average take 5 seconds to complete then u must increment ur progress bar by 20% each time(divide it in 5 interval).To do so create a context variable of integer type say ctx_contint.

set delay property of timedtrigger element to 1 second.

Then in ur mprogressbar() method write code


if(!(Condition indicating succesfull completion of transaction))

{
wdContext.currentcontextelement.setCtx_contint(wdContext.currentcontextelement.getCtx_contint()+20);

wdContext.currentcontextelement.setCtx_prcnt(wdContext.currentcontextelement.getCtx_contint());
 
wdContext.currentContextElement().setCtx_barcolor(WDProgressIndicatorBarColor.POSITIVE);
 
 wdContext.currentContextElement().setCtx_dispval(wdContext.currentContextElement().getCtx_va_prcnt()+"%"); 
}
else
{
wdContext.currentcontextelement.setCtx_prcnt(100);
 
wdContext.currentContextElement().setCtx_barcolor(WDProgressIndicatorBarColor.POSITIVE);
 
 wdContext.currentContextElement().setCtx_dispval(wdContext.currentContextElement().getCtx_va_prcnt()+"%"); 
}

Please provide point if helpful

Regards

Surender Dahiya

Former Member
0 Kudos

Hi,

How can we estimate transaction time as 5 or 10 sec..Generally progress bar is a picture representation of the background transaction process.Generally one cant estimate the time of the transaction.The progress bar has to move according to the transaction..

How to solve this??

Regards

Padma N

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

use the timmed trigger Ui component and set the delay

in the action handler of this set the (display)values for the progress bar.

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

can you give me any sample program or any pdf for this

Regards

Padma N