We have 40 companies in the database and adding all the time. Is it possible to write a report to go through each company and change the posting date (From and To) by running a single report?
I have written some code but the draw back is that I have to hard code to Company Name? Is there a way to do it without hard coding the Company Names?
"General Ledger Setup".CHANGECOMPANY('CRONUS UK Ltd.');
VALIDATE("Allow Posting From",vAllowPostinFrom);
VALIDATE("Allow Posting To","vAllow PostingTo");
MODIFY;
"General Ledger Setup".CHANGECOMPANY('CRONUS UK Ltd 2');
VALIDATE("Allow Posting From",vAllowPostinFrom);
VALIDATE("Allow Posting To","vAllow PostingTo");
MODIFY;
Regards
Mike
0
Answers
There is a way. System table called Company exists and it only consists of field Name in which it stores name of company. To see how it looks like create a new form with table Company and make a list and do a preview.
Hope it helps!
So, make a loop:
But be carefull with validates if you use changecompany. If in the onvalidate trigger is also code that change a other table, these records in the other table will be changed on the company from where the report is running.
Regards
Works really well
Just assign those values, and if you need to run any of the validation logic, then you recreate that in your report. If there is no code in OnValidate of those fields, then nothing is lost. If there IS code in there, then all it takes to screw up this process is for someone to put in logic that uses a record variable.
DO.... NOT.... USE.... VALIDATE.... WHEN.... USING.... CHANGECOMPANY!!!
There, did it anyway :whistle:
RIS Plus, LLC
The source was only copy&paste (forgotten to remove the validate, thats right).