Capturing a date filter
Bokk
Member Posts: 138
I have created a report with 3 dataitems, indented as follows ->
Customer
Job
Job Ledger Entries
The user can/should select a date range on the request form based on the "Date Filter" field in the Job table (Ledger DataitemLink:Job No.=FIELD(No.),Posting Date=FIELD(Date Filter). PrintOnlyIfDetail:YES in Job Dataitem. I have Job header info in 2 sections so it will print for each job and at the top of the next page if job details spans more than one page. The PrintOnlyIf Details property does not seem to stop the header printing when there are no ledger details. For each job I tried to check the ledger entries in code, but cannot seem to capture the Date Filter off the request form to set the SHOWOUTPUT accordingly. How would I reference this correctly?
OnPreSection() - Header section
JobLedger.SETCURRENTKEY("Job No.","Posting Date");
JobLedger.SETRANGE("Job No.",Job."No.");
JobLedger.SETFILTER("Posting Date",'="Date Filter"');
Thanks
Customer
Job
Job Ledger Entries
The user can/should select a date range on the request form based on the "Date Filter" field in the Job table (Ledger DataitemLink:Job No.=FIELD(No.),Posting Date=FIELD(Date Filter). PrintOnlyIfDetail:YES in Job Dataitem. I have Job header info in 2 sections so it will print for each job and at the top of the next page if job details spans more than one page. The PrintOnlyIf Details property does not seem to stop the header printing when there are no ledger details. For each job I tried to check the ledger entries in code, but cannot seem to capture the Date Filter off the request form to set the SHOWOUTPUT accordingly. How would I reference this correctly?
OnPreSection() - Header section
JobLedger.SETCURRENTKEY("Job No.","Posting Date");
JobLedger.SETRANGE("Job No.",Job."No.");
JobLedger.SETFILTER("Posting Date",'="Date Filter"');
Thanks
SGM
0
Comments
-
Hello
JobLedger.SETCURRENTKEY("Job No.","Posting Date");
JobLedger.SETRANGE("Job No.",Job."No.");
JobLedger.SETFILTER("Posting Date",'="Date Filter"');
Should be something like this instead...
JobLedger.SETFILTER("Posting Date",'>=%1&<=%2',"Starting Date","Ending Date");
"Starting Date" and "Ending Date" are Date variables in request form...
Maybe you should consider moving your code to OnPreDataItem trigger...
In .NET we believe
0 -
Hi
Actually you dont even have to use request form.
You can use GETFILTER to get the filter specified by user.
FilterString := GETFILTER("Date Filter");
(FilterString is a Text variable)
then you can use it to apply filter
RecVariable.SETFILTER("Date Field", FilterString );
Regards
Jyotsna______Doubt is the father of Invension_______0
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
- 322 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