SETFILTER blank is not working in range case

neha_sarda
Member Posts: 5
Hi ,
I have a text field "G/L Account Range" which has a values in range Ex. 7110..7193. I have to filter this field to non blank values. When I write a code:
CostType.SETFILTER("G/L Account Range",'<>%1','');
I am getting following error:
The filter '<>''' on the G/L Account Range field in the Cost Type table must specify an interval. You can use two permitted formats for filters that specify an interval: * A Selects values equal to A. * A..Z Selects values between A and Z, inclusive.
Can someone suggest how can I specify a blank filter for this field?
I have a text field "G/L Account Range" which has a values in range Ex. 7110..7193. I have to filter this field to non blank values. When I write a code:
CostType.SETFILTER("G/L Account Range",'<>%1','');
I am getting following error:
The filter '<>''' on the G/L Account Range field in the Cost Type table must specify an interval. You can use two permitted formats for filters that specify an interval: * A Selects values equal to A. * A..Z Selects values between A and Z, inclusive.
Can someone suggest how can I specify a blank filter for this field?
0
Comments
-
How can u filter "Blank" on G/L Account Range..
I mean its having range 7110..7193 and you wont find any blank record.
Eg. You have 5 records in table viz. 2,6,9,13,18 ,now how can u find blank record in that table0 -
It was just an example, there are records which have blank values for field "G/L Account range". So I want to apply filter for non bank values.0
-
The field you want to filter wouldn't by any chance have a fieldclass of "Flowfilter" ?Best regards
Tommy0 -
It does not have a fieldclass. Only table relation is defiend as "G/L Account".0
-
Doesn't make much sense.
Can you recreate the scenario in a table with 2 fields in it and code on "on validate" that produces the error? If so then try pasting the text-object as code here on the forum. The it should be possible to recreate it and thus figure out what goes wrong.
Ie. a table with 2 fiels
1. primary key - code 10
2. range field - text 250 - relation to table 15
then onvalidate on "range field" put the code: SETFILTER("Range Field",'<>%1','') and see if it reproduces the error.Best regards
Tommy0 -
You could try 0..A or 0..9999999999. That would effectively do the same thing if all of your G/L Accounts are numbers.
My guess as to why it is happening is that in order to apply your filter the system is looking at each record to see if it matches. It then ends up with this weird hybrid filter between what you set and the data. Maybe something like <>''100..200, which blows up the filtering.
If you are only storing a range in the field, just 100..200 and not 100..200|400..500 or something, try splitting it out into Min G/L Account and Max G/L Accounts fields. Then you can do a SETRANGE("G/L Account No.", Min Account, Max Account)0 -
a) Do you have some validation code on the filter field that may produce the error?
b) Are you able to blank an existing range?
If answers are yes (a) and no (b) then try revise your validation code to allow a blank filter value (if applicable) or try to useCostType.SETFILTER("G/L Account Range",'<>''''');
instead (5 single quotes in a row).0 -
Also tried,
CostType.SETFILTER("G/L Account Range",'<>''''');
But getting the same error:
Microsoft Dynamics NAV
The filter '<>''' on the G/L Account Range field in the Cost Type table must specify an interval. You can use two permitted formats for filters that specify an interval: * A Selects values equal to A. * A..Z Selects values between A and Z, inclusive.
OK0 -
Can you provide us the full code where you are trying to do this.
Bcoz in 15 table you have totaling field which has the same properties. If I filter for blank its happening.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