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?
0
Comments
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 table
Tommy
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.
Tommy
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)
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 use instead (5 single quotes in a row).
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.
OK
Bcoz in 15 table you have totaling field which has the same properties. If I filter for blank its happening.