TextBox to act as Standard NAV date Filter

gulamdastagir
Member Posts: 411
i have a textbox with source expression as varText.
But it does not support validation and when i type 'T' for today etc so how to get the functionality?
But it does not support validation and when i type 'T' for today etc so how to get the functionality?
Regards,
GD
GD
0
Comments
-
why make it text type if it's really a date type?
you can make it a date type & convert to text when needed if you like.0 -
actually i want to filter a Range 010101..080808 and only one text box but i guess i have to take two textboxes with variables of type Date
thanks savatageRegards,
GD0 -
In the OnAfterInput trigger for your text box you can call the MakeDateText function in codeunit 1. Pass it the Text parameter that comes with this trigger.0
-
Here how is my tip and trick works for this.
1. Declare a record variable that has a field datatype Date in it. Lets say we use the Date record as variable recDate.
2. Declare a text variable for your TextBox to act as Standard NAV date Filter. Lets use myTextDate.
3. Put myTextDate on the SourceExpr property of your textbox.
4. On the validate trigger of your textbox. Put the code like this.recDate.SETFILTER("Period Start", myTextDate); myTextDate := recDate.GETFILTER("Period Start");
5. Done.
Note : If you input the character listed below in the textbox:
M = Will return the date of Monday in the current week.
T = Will return the date of Tuesday in the current week.
W = Will return the date of Wednesday in the current week.
TH = Will return the date of Tuesday in the current week.
F = Will return the date of Friday in the current week.
S = Will return the date of Saturday in the current week.
SU = Will return the date of Sunday in the current week.
If you want to capture the character 'T' as today or 'W' as workdate then you must have a LONG code like this.myTextDate := UPPERCASE(myTextDate); //---- Make TU as Tuesday IF STRPOS(myTextDate, 'TU') > 0 THEN BEGIN recDate.SETFILTER("Period Start", 'T'); IF STRLEN(myTextDate) <> 2 THEN BEGIN WHILE STRPOS(myTextDate, 'TU') <> 0 DO BEGIN myTextDate := COPYSTR(myTextDate, 1, STRPOS(myTextDate, 'TU') - 1) + recDate.GETFILTER("Period Start") + COPYSTR(myTextDate, STRPOS(myTextDate, 'TU') + 2, STRLEN(myTextDate)); END; END ELSE myTextDate := recDate.GETFILTER("Period Start"); END; //---- Make WE as Wednesday IF STRPOS(myTextDate, 'WE') > 0 THEN BEGIN recDate.SETFILTER("Period Start", 'W'); IF STRLEN(myTextDate) <> 2 THEN BEGIN WHILE STRPOS(myTextDate, 'WE') <> 0 DO BEGIN myTextDate := COPYSTR(myTextDate, 1, STRPOS(myTextDate, 'WE') - 1) + recDate.GETFILTER("Period Start") + COPYSTR(myTextDate, STRPOS(myTextDate, 'WE') + 2, STRLEN(myTextDate)); END; END ELSE myTextDate := recDate.GETFILTER("Period Start"); END; //---- for the character T as TODAY IF STRPOS(myTextDate, 'T') > 0 THEN BEGIN IF STRLEN(myTextDate) <> 1 THEN BEGIN WHILE STRPOS(myTextDate, 'T') <> 0 DO BEGIN myTextDate := COPYSTR(myTextDate, 1, STRPOS(myTextDate, 'T') - 1) + FORMAT(TODAY) + COPYSTR(myTextDate, STRPOS(myTextDate, 'T') + 1, STRLEN(myTextDate)); END; END ELSE myTextDate := FORMAT(TODAY); END; //---- for the character W as WORKDATE IF STRPOS(myTextDate, 'W') > 0 THEN BEGIN IF STRLEN(myTextDate) <> 1 THEN BEGIN WHILE STRPOS(myTextDate, 'W') <> 0 DO BEGIN myTextDate := COPYSTR(myTextDate, 1, STRPOS(myTextDate, 'W') - 1) + FORMAT(WORKDATE) + COPYSTR(myTextDate, STRPOS(myTextDate, 'W') + 1, STRLEN(myTextDate)); END; END ELSE myTextDate := FORMAT(WORKDATE); END; recDate.SETFILTER("Period Start", myTextDate); myTextDate := recDate.GETFILTER("Period Start");
Hope this works for you tooNavision noob....0 -
Thanks to jreynolds for his post that got me going in the right direction. I have a report where I have a text box on the options tab, and I want that text box to work as a date and recieve date ranges and values such as "t", "y-1", etc. Instead of using MakeDateText, I found MakeDateFilter in Codeunit1. It works!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