Hi All,
I have a requirement to get all ADusers information in a database from all companies in the same database.
Now I am getting ADusers information from the current company from which I'm running a customozed report.
How can I get all ADusers iinformation in all companies in a single report.(all users information from all companies)
how can I use CHANGECOMPANY function in report.
Please help me.
Thanks in advance.
Regards,
Dilla
0
Comments
//Loop through all of the companies, in each one add the ADUsers data to a temporary record. This is on the PreDataItem of the Integer dataitem.
Company.RESET;
IF Company.FINDFIRST THEN REPEAT
ADUsers.RESET:
ADUsers.CHANGECOMPANY(Company.Name);
//if there are filters to be applied through a request form apply them here
if ADUsers.FINDFIRST THEN REPEAT
tmpADUsers := ADUsers;
tmpADUsers.INSERT;
UNTIL ADUsers.NEXT = 0;
UNTIL Company.NEXT = 0;
//One dataitem in the report
OnPreDataItem (after the above)
tmpADUsers.RESET;
SETRANGE(Number,1,tmpADUsers.COUNT);
bfirst := TRUE;
OnAfterGetRecord
IF bfirst THEN BEGIN
bfirst := FALSE;
tmpADUsers.FINDFIRST;
END ELSE
tmpADUsers.NEXT;
//and on the sections, just have the data display using the tmpADUsers variable
//NOTE - you may have to create a copy of the ADUsers table, and add a Company field to it which becomes part of the primay key. This table does not need to be in the license range. Use this record as the temporary record. This would ensure that if the same user is in more than one company that you can insert it. This requires a change in the code that inserts the temporary record.
tmpADUsers.TRANSFERFIELDS(ADUsers);
tmpADUsers.Company := Company.Name;
tmpADUsers.INSERT;
Hope this helps.
-a
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Thank you for your reply,
I am getting data from "Change Log Entry" table and I have one customized table called "Power Users".now I have to generate a report from all all companies in database.
In "Power Users" table users may differ for each company. Now I am getting "power users" cheanges in report but I am getting only current company "Power users" changes.
how can I get all "Power Users" changes from all companies in a single report.
Kindly help me.
Thanks in advance.
Regards,
Dilla