I am trying to run a report modally, that gets a customer number, runs another report and uses the current customer number as the "Sell-To Customer No." filter in the other report. How do I get it to automatically fill in the filter field of the 2nd report that is called?
0
Comments
PS. I've created a sample for you email report which is available at the download section.
http://www.mibuso.com/dlinfo.asp?FileID=519
SalesHeader.SETFILTER("No.",'',"No.");
Is this the correct way to declare the filter in the 1st report? Sorry to ask such simple questions but I've not been doing this long and I'm trying my hardest to learn quickly.
I am using the customer table for the first report, and the Sales Header for the 2nd.
Thanks for the download. I'll give that a try later. How should I change it to work with my current Sales Order summary report?
You will have to modify it to make it fit for Sales Header reports.
In order to do this, define a sales header variable like my Cust.
Set the filters like
And replace the Cust parameter in the saveashtml by the SalesHdr.
This will now make a html file of all Sales Headers related to the customer and send this by email.
Any ideas?
I still can find how to push a filter set in 1 report onto the next one?
Be sure to test it on a fake email addres!
If you mail me your customised report, I will have a look at it.
You can also try to send a small testemail using the mail codeunit to find out if the problem is in the mail codeunit or in the report.
The problem I'm still having is that it's sending the full Sales order summary report (all customers details) to just 1 customer. I will email you the fobs if you send me your email address.
Thank you.
Still, you need to change the report.run to the HTML thing and add if/then to the mail statement, but you can copy that from my report.
Succes.
I wish I could return the favour - perhaps when I've been doing this for 8 years, like yourself, I'll be able to lend a hand.
Report.Runmodal
By
Report.SAVEASHTML
Like in my report.
And in 8 years, I am affraid, Navision will exist only in the History books. So everyone gets a clean start with Dynamics, and we will see who is helping who then
Add the parameter, please.
I thought only the RunModal thing could divide it up?
Stewart
Please repost you code with the SAVEASHTML.
One more quick question though, if the "Outstanding Qty" is 0, can I tell it not to produce a report? Would a simple filter do this?
CurrReport.BREAK
OR
CurrReport.SKIP
OR
CurrReport.QUIT
Depends on what you are going to do.
I've tried using:-
Lines := "Sales Line".COUNTAPPROX
If Lines = 0 THEN
CurrReport.QUIT;
..but then the report produces nothing, presumably because it can't count the lines from the header section of the report.
I've tried applying a filter in the properties of the data item, and also using the SETTABLE function, but I get the same problem; a header with a title on it.
Sorry to ramble on, but I wanted to explain more clearly.
Thank you
Maybe better is to make a fuction in the mail report which returns false if the report should not be generated.
I hope you understand this, if not, just ask. :?
I'll give the function thing a bash and get back to you if/when I get stuck.
Ta,
Stoo
So far I have:
Customer - OnAfterGetRecord()
SH.SETRANGE("Sell-to Customer No.","No.");
Filename := ('c:\expedite\') + ("No.") + ('.htm');
Subject := "No.";
NoReport;
IF DoRun THEN
REPORT.SAVEASHTML(50100, Filename, FALSE, SH);
Mail.NewMessage('stewart.smyth@drondickson.co.uk','',Subject,'Attached is a list of outstanding orders',Filename,TRUE);
NoReport()
SL.GET(SH."No.",SL."Document No.");
NoLines := SL.COUNT;
IF NoLines <> 0 THEN
DoRun := TRUE
ELSE DoRun := FALSE;
But it still isn't working - same as before. Where am I going wrong?
(The setrange instead of get)
Stewart
If so, you should add this to you filter on the SL variable.
The problem now lies that we have orders that are cancelled but still show open. If an order is cancelled, the Qty is set to 0. If I filter by this then I still get the header. Usually when an order is cancelled the user types one of the following into the box:
Order Cancelled
order cancelled
Cancelled
cancelled
(note, it is case-sensitive)
I am having trouble filtering by the word cancelled. I have tried using the wildcard eg: *Cancelled*|*cancelled* but it doesn't seem to do anything.
How would I apply such a filter?
You can however also add a line