Options

How to filter an Integer field

jam176jam176 Member Posts: 27
Hi everybody!

As it works in all tables with the built-in navision filter there must be a possibility to filter an Integer field by program.

I tried
FILTERSTRING:= '1..10';
table.setrange("field", FILTERSTRING);

table.setfilter("field", '%1', FILTERSTRING);

But all of this is not allowed conversion...
thx
jam176

Comments

  • Options
    leugimleugim Member Posts: 93
    did you try this??

    >> table.SETFILTER("field", '%1..%2',1,10);
    >> table.SETRANGE("field",1,10);

    with SETFILTER you are using internal variables %1 and %2, which are replaced by 1 and 10. and with SETRANGE you are setting a range from 1 to 10 (both included). of course, "field" must be a numeric field (integer, decimal, biginteger...)

    codeing SETRANGE or SETFILTER like that the result must be the same

    please take a look at Navision Technical help: designing an object, open code window, press F5 (symbol menu), select a table in left column, select FILTER option in middle column and finally select SETRANGE/SETFILTER in right column. then press F1 and SETRANGE/SETFILTER help appears, showing the correct syntax, some explanations about how it works and some examples you can copy to your code

    hope this will help. regards
    _______________
    so far, so good
  • Options
    kinekine Member Posts: 12,562
    In your case, when you have whole filter in the string you need to use:
    FILTERSTRING:= '1..10';
    
    table.setfilter("field", FILTERSTRING); 
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    jam176jam176 Member Posts: 27
    ahhh!!! :D

    thank you KINE, that's it!

    (thank you leugim also, but my problem was the usage of a filterstring!)[/code]
    thx
    jam176
Sign In or Register to comment.