Report Filter problem

mkpjsr
Member Posts: 587
Hi all,
I have designed a report with the following data item:-
DataItem Name
Sales Cr.Memo Line
Sales Invoice Header
Sales Invoice Line
Here the value DataItemLink property of Sales Invoice Line is Document No.=FIELD(No.)
but there is no such relation between Sales Cr.Memo Line and Sales Invoice Header data items.
I am using posting date as a filter field from Sales Invoice Line Table and this filter has no affect on Sales Cr.Memo Line table. Report is fetching all data from this table.
What should i do to resolve this problem.
I have designed a report with the following data item:-
DataItem Name
Sales Cr.Memo Line
Sales Invoice Header
Sales Invoice Line
Here the value DataItemLink property of Sales Invoice Line is Document No.=FIELD(No.)
but there is no such relation between Sales Cr.Memo Line and Sales Invoice Header data items.
I am using posting date as a filter field from Sales Invoice Line Table and this filter has no affect on Sales Cr.Memo Line table. Report is fetching all data from this table.
What should i do to resolve this problem.
0
Comments
-
How about adding a dataitem Sales Cr.Memo Header?0
-
NAV doesn't know what filters you've applied to the request form of a data item until the code actually gets to the OnPreDataItem trigger for it.
You have a few of options:
You can move your data items around.
You can filter using a global variable and the Options Request Form.
You can add a "fake" Sales Invoice Line data item to the start of your report, get the filters before running everything else, and apply them as needed.
Play around with each and see what works best for this scenario.0 -
matttrax wrote:NAV doesn't know what filters you've applied to the request form of a data item until the code actually gets to the OnPreDataItem trigger for it.
What about Daily Invoicing Report...:Report - OnPreReport() FilterString := COPYSTR("Sales Invoice Header".GETFILTERS,1,MAXSTRLEN(FilterString))
;
You could GETFILTER("Posting Date") and apply that on another dataitem.
The only thing I don't like about doing these type of things is people can add filters on the Req. sheet for the dataitem - for example, sell-to customer no... And then do you take that into account and copy the filters as well.-Lavin
"Profanity is the one language all programmers know best."0 -
klavin wrote:What about Daily Invoicing Report...:
I believe you can do a GETFILTERS to get ALL the filters before you get to the data item. That's common to print on the top of reports. But if you try to get the filter for a specific field I'm pretty sure it doesn't work unless you have reached the OnPreDataItem trigger for that data item. I seem to remember trying to do this several time. Hopefully someone will correct me if I am wrong.0 -
I believe they were trying to say the Daily Invoicing Report - on the request form already has the ability to add into one report Credits & invoices. So you can use that report as your example, to see what was done.
Or even, Rename it and edit that report since the bones are already there.0 -
Hi,
I have tried the below code assuming that the date filter is in the form: 12/12/09..31/12/09
globals used
FilterString ->text
FirstDateString->text
SecondDateString->text
FirstDate->Date
SecondDate->Date
Sales Invoice Header - OnPreDataItem()
FilterString := "Sales Invoice Header".GETFILTER("Posting Date");
FirstDateString:=COPYSTR(FilterString,1,8);
SecondDateString:=COPYSTR(FilterString,11,8);
Sales Cr.Memo Line - OnPreDataItem()
EVALUATE(FirstDate,FirstDateString);
EVALUATE(SecondDate,SecondDateString);
"Sales Cr.Memo Line".RESET;
"Sales Cr.Memo Line".SETRANGE("Sales Cr.Memo Line"."Posting Date",FirstDate,SecondDate');
but this filter is not working0 -
A look at the Daily Invoicing report again, if you have access to is...:
Try:
OnPreDataItem of Sales Cr.Memo Header"Sales Invoice Header".COPYFILTER("Posting Date","Sales Cr.Memo Header"."Posting Date");
Lavin-Lavin
"Profanity is the one language all programmers know best."0 -
If you have use Posting Date as Reqfilterfields on Sales Inv. Line ,then onprereport you can use GETRANGEMAX and GETRANGEMIN to find the start date and end date ...0
-
navinb wrote:If you have use Posting Date as Reqfilterfields on Sales Inv. Line ,then onprereport you can use GETRANGEMAX and GETRANGEMIN to find the start date and end date ...
If you're just copying the filter, why not use COPYFILTER? I agree, that is how you could get the mins and maxes, but from what he is doing COPYFILTER makes more sense.
mkpjsr: I still recommend taking a look at some of the features in the Application Designers Guide on the product CD and online help just for some references on these functions so you know some of the other functions you can use.-Lavin
"Profanity is the one language all programmers know best."0 -
yes i agree with you Lavin,but looking at the original code user is specifically onto calculating startdate and enddate first ,so i tot he wants that apart from setting filters also:
FilterString := "Sales Invoice Header".GETFILTER("Posting Date");
FirstDateString:=COPYSTR(FilterString,1,8);
SecondDateString:=COPYSTR(FilterString,11,8);
Sales Cr.Memo Line - OnPreDataItem()
EVALUATE(FirstDate,FirstDateString);
EVALUATE(SecondDate,SecondDateString);
"Sales Cr.Memo Line".RESET;
the whole part can be easily handled with GETRANGEMAX and GETRANGEMIN,
if it is just limited to getting the whole range then
COPYFILTER must work
"Sales Cr.Memo Line".SETRANGE("Sales Cr.Memo Line"."Posting Date",FirstDate,SecondDate');
Thanks
Navin0 -
If i am writing this code under OnPreDataItem of Sales Invoice Header then i am not able to fetch the values of these two globals "FirstDate" and "SecondDate" under OnPreDataItem of Sales Cr. Memo Line.
FirstDate:="Sales Invoice Header".GETRANGEMAX("Sales Invoice Header"."Posting Date");
SecondDate:="Sales Invoice Header".GETRANGEMIN("Sales Invoice Header"."Posting Date");0 -
"Sales Invoice Header".COPYFILTER("Posting Date","Sales Cr.Memo Header"."Posting Date");
Lavin
I have tried this, but its not working, do i need to write some code for filtering after COPYFILTER.
Please guide me.0 -
mkpjsr wrote:Hi all,
I have designed a report with the following data item:-
DataItem Name
Sales Cr.Memo Line
Sales Invoice Header
Sales Invoice Line
Here the value DataItemLink property of Sales Invoice Line is Document No.=FIELD(No.)
but there is no such relation between Sales Cr.Memo Line and Sales Invoice Header data items.
I am using posting date as a filter field from Sales Invoice Line Table and this filter has no affect on Sales Cr.Memo Line table. Report is fetching all data from this table.
What should i do to resolve this problem.
You are going about this completely the wrong way.
to answer your question:mkpjsr wrote:What should i do to resolve this problem.
Before you start programming in Navision you need to understand how Navision works, and I mean Navision the application, not C/SIDE and C/AL. You need to know the table structure of Navision and how data is posted. Untill you do this you will never be able to use Navision to its fullest. Everyone needs to post at least 100 sales orders, purchase orders, payments receipts, Financial journals etc, before expecting to get everything to work the way they need.
in answer to your report requirement, once you learn't Navision, you would realize that you need to start with the table "Cust. Ledger Entry" and indent the other sections under this.David Singleton0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions