Execute a job on data in several companies

  • April 29, 2010
  • 2 Comments

There is a verry simple trick to loop through some companies and execute some code in them.

Just write:

DataArea dataArea;
;
while select dataArea
where !dataArea.isVirtual
{
    changecompany(dataArea.id)
    {
        // Do Something...
    }
}

Note! Make sure that you clear the table variable after each companychange (common = null;).