How to use progress bar in dynamics ax Part1

Description:-

In this article we will see about how to get prime Number from 1 to 10000. It’s little difficult to get. Here I have used progress bar to get prime number for little display information while counting prime number between those two numbers what we have set for from to to in code. Here I have used progress bar for information it counting the prime number and after done it will display information in Infolog window. In Progressbar it pretty easy to set and we can set animation in Progressbar to display in windows. Here is the simple Job code to Used Progressbar in Ax.

Code:-

Static void Progress_PrimeNumber(Args _args)
{
    #avifiles
    boolean checkPrime,_showProgess = true;
    SysOperationProgress progressBar = newSysOperationProgress();
    int counter,out;
    ;
    counter = 1;
    out = 10000;
    while(counter < out)
    {
        checkPrime = ((counter mod2)!=0&& (counter mod3) !=0);
        if(checkPrime)
        {
            info(strfmt("its a prime number %1",counter));
        }
        progressBar.incCount();
        progressBar.setCaption(strfmt("Generating the prime number for %1",counter));
        progressBar.setAnimation(#aviUpdate);
        //#AviFindFile);
        //progress.setAnimation(#AviTransfer);
        progressBar.setText(strfmt("Processing %1 out of %2",counter,out));
        counter++;
        progressBar.update(true);
    }
}

Output:-

Related Posts

Previous
Next Post »

Thanks for comments.....