Application Management MAKEDATEFILTER

bhalpin
Member Posts: 309
As usual, something I thought would be simple has turned into a dog-fight.
I need to put a control on a report request form to collect a date filter. Looking at a stock example I went to form 490, Acc. Schedule Overview. There, the date filter is a textbox with the source expression "Acc. Schedule Line"."Date Filter". I copied that control to my request form, and added a global record for the "Acc. Schedule Line" table.
When I ran the report and entered '1.1.09..12.31.09' intothe control I got the error that that string was not a valid date. :-k
So, I traced through the triggers and found myself in codeunit 1 MAKEDATEFILTER. Without studying every line, it looked to me like this code would take a (var) string and cnvert it to a valid date filter - and return an integer value to denote success or failure. \:D/ Just what I needed!
So I changed the textbox to a text(250) var, and in it's OnValidate() trigger I put in a call to that function to validate/format the string entered, and display the integer result and the resulting string. The code looks like this:
Well,, the result was sure disappointing. No matter what text I enter (good date filters, bad ones, complete gibberish, etc.) the integer result is always zero, and the string is unchanged.
So, either that function is 'broken', or I've misinterpreted what it is supposed to do.
Can anyone point out what I've missed?
Thanks in advance
I need to put a control on a report request form to collect a date filter. Looking at a stock example I went to form 490, Acc. Schedule Overview. There, the date filter is a textbox with the source expression "Acc. Schedule Line"."Date Filter". I copied that control to my request form, and added a global record for the "Acc. Schedule Line" table.
When I ran the report and entered '1.1.09..12.31.09' intothe control I got the error that that string was not a valid date. :-k
So, I traced through the triggers and found myself in codeunit 1 MAKEDATEFILTER. Without studying every line, it looked to me like this code would take a (var) string and cnvert it to a valid date filter - and return an integer value to denote success or failure. \:D/ Just what I needed!
So I changed the textbox to a text(250) var, and in it's OnValidate() trigger I put in a call to that function to validate/format the string entered, and display the integer result and the resulting string. The code looks like this:
MESSAGE('Result='+FORMAT(gcuApplicationManagement.MakeDateFilter(gtxtDateFilter)) +'\'+gtxtDateFilter );
Well,, the result was sure disappointing. No matter what text I enter (good date filters, bad ones, complete gibberish, etc.) the integer result is always zero, and the string is unchanged.
So, either that function is 'broken', or I've misinterpreted what it is supposed to do.
Can anyone point out what I've missed?
Thanks in advance
0
Answers
-
Ok, in report 10028, Account Schedule, the OnValidate trigger for the date filter has this code:
Acc. Schedule Name - OnValidate() IF ApplicationManagement.MakeDateFilter(DateFilter) = 0 THEN ; "Acc. Schedule Line".SETFILTER("Date Filter",DateFilter); DateFilter := "Acc. Schedule Line".GETFILTER("Date Filter");
When I stole that and put it in my report (using a temprecord for "Acc. Schedule Line"), I now have the validation/formatting I am ooking for.
I hope this helps the next person ...0 -
Thanks, this did help the next guy (me)
I had a textbox on a form where I wanted the user to enter a filter, and using your suggestion wrote the following function that is exactly what I need.
SetUserFilters()
IF AppMgt.MakeDateFilter(DateFilter) = 0 THEN;
IF DateFilter = '' THEN
SETRANGE("Posting Date")
ELSE
SETFILTER("Posting Date",DateFilter);
DateFilter := GETFILTER("Posting Date");
CurrForm.UPDATE(FALSE);0 -
Thank you very much. This helped me out too.
=D>
Good work.
Elmar.
This should be posted in the How To Section here.Elmar F. Vidisson
Certified Navision Attain Developer0 -
I can't believe this! I'm adding a date filter to a request page and looking at MakeDateFilter and doing some tests. Can't figure it out. So I Google "NAV MakeDateFilter" and this is the 1st hit. And holy crap! It's a thread I started 10 years ago! If only we could remember everything. But there's Mibuso thanfully!
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
- 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