DoEvents (Method)

Applies To:

Application

Description:

Halts a script from executing and switches control to the operating-environment kernel so that the application can respond to pending or queued events. This method is typically placed at the end of a for statement. It is usually included in a script that runs continuously and displays live data.

Note:

The Application.DoEvents() object model syntax is not supported in an Interactive Reporting document file deployed on the EPM Workspace.

Syntax:

Application.DoEvents() 

Example:

This script processes a query five times with limits. A DoEvents method is included to display the applied limits each time the query is processed:

function Wait(ms)
{
var oStart = new Date();
var oNow = new Date();
     while (oNow.getTime() - oStart.getTime() < ms)
         {
              oNow = new Date() ;
               DoEvents();
         }
}

for (i=1;i<=5 ;i++)
{
      // do something  
      if(ActiveDocument.Sections["Query"].Limits[2].Ignore ==false)
            ActiveDocument.Sections["Query"].Limits[2].Ignore=true;
      else
            ActiveDocument.Sections["Query"].Limits[2].Ignore=false;
      Console.Write("processing number:  "+i+"\n")
      ActiveDocument.Sections["Query"].Process()
         Wait(9000) 
}