Источник:
http://blogs.msdn.com/b/emeadaxsuppo...-progress.aspx
==============
Recently I coded an AX 2009 server bound batch job using AOT\Classes\tutorial_runbasebatch and wanted to show the progress of the job within the Batch tasks form.
I was using the common interfaces in RunBase and also RunBaseProgress and found that this is not increasing the Progress in the Batch tasks form. After a little troubleshooting I found that there have been some fixes implemented till Dynamics AX 2009 RU 5 and I noticed that all methods end up calling SysOperationProgressServer at some time and that there a boolean value is set to true by default.
public void new(int _numberOfBars = 1, boolean _bypass=true)
{
Bypass = _bypass;
if ( Bypass )
return;
Due to this the Progress is not updated at any time.
Solution 1:
So one way to get a progress successfully is to directly call SysOperationProgressServer and on calling the new method set Bypass to false. If you go for this way you might need to utilize Global::isRunningOnServer to understand if your code is running on the server or not.
Solution 2:
You could modify the methods new and construct in RunbaseProgress / new and construct in the following way.
Classes \ RunBaseProgress
public static RunbaseProgress construct(
int _numOfBars = 1,
FormBuildControl _embedded = null,
Boolean ifOnSrvBypass = true
)
{
return new RunbaseProgress(_numOfBars,_embedded,ifOnSrvBypass);
}
void new( int _numOfBars = 1,
FormBuildControl _embedded = null,
Boolean ifOnSrvBypass = true
)
{
if ( hasGUI() )
{
if (_embedded)
oprProgressEmbedded = SysOperationProgressEmbedded::newGeneral(_embedded,_numOfBars);
else
oprProgress = new SysOperationProgress(_numOfBars);
}
else
{
// if no client is present, we can only use the SysProgress table to save progress info
oprProgressServer = new SysOperationProgressServer(_numOfBars,ifOnSrvBypass);
}
}
Similar modifications as above could be applied to RunBase \ progressInit to call construct from there in the right way.
--author:Christian Wolf--editor:Christian Wolf--date:22-09-2010
Источник:
http://blogs.msdn.com/b/emeadaxsuppo...-progress.aspx