Hi all,
This should be a very simple one -- hope!
I'm trying to create a report where I get the all four companies that are in my database, and get a list of all the customers for that company.
I mean something like this:
Company One
Customer #1
Customer #2
Company Two
Customer #3
Customer #4
Company Three
Customer #5
Customer #6
Company Four
Customer #7
Customer #8
I'm trying it by making a loop with the Company table, then I put the Customer table into the loop and insert a CHANGECOMPANY function in the Customer section, but all I get is always the same customers, like this:
Company One
Customer #1
Customer #2
Company Two
Customer #1
Customer #2
Company Three
Customer #1
Customer #2
Company Four
Customer #1
Customer #2
What #&
@## am I doing wrong??? ](*,)
Answers
Integer
Customer
Integer OnpreDataItem
SETRANGE(Number,1,4);
Customer OnPreDataItem
CASE Integer.Number OF
1: Customer.ChangeCompany(Company1);
2: Customer.ChangeCompany(Company2);
3: Customer.ChangeCompany(Company3);
4: Customer.ChangeCompany(Company4);
END;
Hope this helps
Regards
My world: Dynamics NAV,SQL and .NET
CEO at Solving Dynamics
http://www.solvingdynamics.com
-->Company One:
Customer #1
Customer #2
-->Company Two:
Customer #1
Customer #2
-->Company Three:
Customer #1
Customer #2
-->Company Four:
Customer #1
Customer #2
It really doesn't matter which table I indent because I always get the same results, as if the CHANGECOMPANY function was not working by some reason.
"I don't want to believe. I want to know." (Carl Sagan)
Dont forget to indent the Customer Table.
Integer
Customer
And are you sure that the other companies have different information?
Sorry out of ideas
My world: Dynamics NAV,SQL and .NET
CEO at Solving Dynamics
http://www.solvingdynamics.com
OK, gonna explain my full plan. Maybe I'm leaving some important hint.
I want a report where I get the names of the four companies, and the names and balances of each customer, filtering the Customer table with a WHERE(Balance (LCY)=FILTER(>0)) sentence. The Customer table is NOT a data-per-company one. It's common for all four companies. But transactions are of course dpc.
The perfect display would be:
Company One: Customer 1 ... Balance in Euro Customer 2 ... Balance in Euro Company Two: Customer 3 ... Balance in Euro Customer 4 ... Balance in Euro Customer 5 ... Balance in Euro
And so on.But I only can get the Customer names and balances for the first company (that is, the current one). If I change manually the company (Ctrl+O), I can see different customers and balances, so info IS different for each company.
I guess I'm missing something very important but I can't find out what the heck is!!
"I don't want to believe. I want to know." (Carl Sagan)
Perhaps your should CHANGECOMPANY for the Cust. Ledger Entry and Cust. Detailed Ledger Entry tables :idea:
one solution is use a record varible of the customer table and use an integer dataitem like this
company
Integer
on then onafergetrecord trigger of the Company dataitem, set the range ann get the recordcount. Use this count to set the interval of the integer dataitem.
on then on predataitem use the customer.changecompany instrucction
yoh should use the changecompany instrucction for the cust ledger entry record too.
Regard
David
bjarnib@dagurgroup.is
I am still stuck with this issue, but thank you guys for trying so hard.
Gonna study it in depth -- I promise you a solution. :-k
"I don't want to believe. I want to know." (Carl Sagan)
This is coding that I have used
I am inserting records into other tables but the CALCFIELDS works for each company that I access. :P
DataItems:
Company
Cust. Ledger Entry (Indented 1)
Cust. Ledger Entry Properties:
DataItemTableView: SORTING(Customer No.) ORDER(Ascending) WHERE(Amount=FILTER(>0))
GroupTotalFields: Customer No.
In Cust. Ledger Entry - OnPreDataItem:
CurrReport.CREATETOTALS(Amount);
CHANGECOMPANY(Company.Name);
In Sections create the following:
- Company Header (just for title)
- Company Body
- Cust. Ledger Entry GroupFooter, and
- Cust. Ledger Entry Footer.
I just can assume now what was failing before: I was using a Record Variable in the CHANGECOMPANY sentence. When I removed it, everything went right. Know why? #-o
"I don't want to believe. I want to know." (Carl Sagan)
So simple like that.
"I don't want to believe. I want to know." (Carl Sagan)