Doens.be

  • Linkedin flickr twitter delicious Facebook Youtube

Execute a job on data in several companies

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;).

Tags: , , , ,

2 Responses to “Execute a job on data in several companies”

  1. April 29th, 2010 at 15:45

    Eric says:

    Could you please expand on your comment “Note! Make sure that you clear the table variable after each companychange (common = null;).”

  2. April 30th, 2010 at 12:19

    Execute a job on data in several companies – part2 | Doens.be says:

    [...] one of my previous posts I explained that you can switch company with the keyword changecompany. I also made a remark that you should set the value of your table-value to null after each [...]

Leave a Reply