Options

SETFILTER blank is not working in range case

neha_sardaneha_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?

Comments

  • Options
    abhinav0408abhinav0408 Member Posts: 35
    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 table
  • Options
    neha_sardaneha_sarda Member Posts: 5
    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.
  • Options
    Tommy_SchouTommy_Schou Member Posts: 117
    The field you want to filter wouldn't by any chance have a fieldclass of "Flowfilter" ?
    Best regards
    Tommy
  • Options
    neha_sardaneha_sarda Member Posts: 5
    It does not have a fieldclass. Only table relation is defiend as "G/L Account".
  • Options
    Tommy_SchouTommy_Schou Member Posts: 117
    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
    Tommy
  • Options
    matttraxmatttrax Member Posts: 2,309
    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)
  • Options
    vaprogvaprog Member Posts: 1,118
    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 use
    CostType.SETFILTER("G/L Account Range",'<>''''');
    
    instead (5 single quotes in a row).
  • Options
    neha_sardaneha_sarda Member Posts: 5
    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.
    OK
    :(
  • Options
    MGM08MGM08 Member Posts: 41
    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.
Sign In or Register to comment.