In the "Sales Invoice Header" these three customer have altogether 10 invoices. I would like to filter the "Sales Invoice Header" that contains these invoices only.
"Sales Invoice Header".SETFILTER("Sell-to Customer No.",Customer.GETFILTER("Sales (LCY)")); //<-- not works
Of course this doesn't work. It doesn't make no sense. "Sales (LCY)" is a decimal field and "Sell-to Customer No." is a code field related to the Customer table. If you want to see only those invoices that are addressed to Customers that have a "Sales (LCY)" greater than or equal to 1000 then you have to design your report/form in another way.
"Money is likewise the greatest chance and the greatest scourge of mankind."
I think I can check the amount in the codeunit function. But it not a very nice solution, but if its the only then i have to do that.
Yes, that would be possible, but I also think that this isn't a very nice solution. What if the user wants to filter another field of the Customer table? You could pop up a Customer List where the user could filter anything and then just compare in the codeunit if the Customer in "Sell-to Customer No." is also in your list of Customers. But I think your solution shouldn't start at a Sales Invoice.
"Money is likewise the greatest chance and the greatest scourge of mankind."
Comments
Eg:
filtered customer table: (No.)
- C0001
- C0003
- C0008
In the "Sales Invoice Header" these three customer have altogether 10 invoices. I would like to filter the "Sales Invoice Header" that contains these invoices only.
I have an other question:
what there is in that case, when I filter e.g. the Sales (LCY)? This field not in the "Sales Invoice Header"...
e.g.:
cust.SETFILTER(cust."Sales (LCY)", '>=1000');
"Sales Invoice Header".SETFILTER("Sell-to Customer No.",Customer.GETFILTER("Sales (LCY)")); //<-- not works
"Sales Invoice Header".FINDSET;
Is this the exact code?
You filter on cust: But you get the filter from customer:
Customer.SETFILTER(Customer."Sales (LCY)", '>=1000');
"Sales Invoice Header".SETFILTER("Sell-to Customer No.",Customer.GETFILTER("Sales (LCY)")); //<-- not works
"Sales Invoice Header".FINDSET;
And do you filter on the Customer Code using a filter from an Amount field?
That code was only a bad example.
Have you got any hint how can i solve this problem another way?
I filtered the "Sales Invoice Header" then I call a codeunit function.
These codeunit function send the invoice details for the customers via email.
I think I can check the amount in the codeunit function. But it not a very nice solution, but if its the only then i have to do that.