filter problem

metarockmetarock Member Posts: 13
Hi :D
I hav problem with filter "<>(1000|2000)" and "<>(1000..2000)" ?
msg error "You entered an invalid expresseion ...."

Comments

  • kapamaroukapamarou Member Posts: 1,152
    You could try <>1000&<>2000 or <1000|>2000.
  • metarockmetarock Member Posts: 13
    nn,the "1000|2000 or 1000..2000" r the filter entered by the user ,for me i take this filter and put in SETFILTER :?:
  • kapamaroukapamarou Member Posts: 1,152
    So how does your user enter the filter exactly, and what do you do exactly?

    Are you trying to "negate" the filter by code?
  • metarockmetarock Member Posts: 13
    the filter that i want to applie SETFILTER("No.",'<>(filter entered by the user)'); :!:
  • ccorreiaccorreia Member Posts: 36
    Why dont you try something like this:
    SETFILTER("No.",'<>%1',textvar);
  • metarockmetarock Member Posts: 13
    I tried before ,it's same :?
  • kinekine Member Posts: 12,562
    You will need to negate the filter itself. I think that it will be no simple task. Question is, why you need that? Isn't the problem somewhere else? Could you solve it by another way?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • metarockmetarock Member Posts: 13
    the idea is the user will entered 1000 or 2000 or 1000&2000 or 1000..2000 for first part i will make this filter
    SETFILTER("No.",(filter entered by user));
    for calc some total ,then i need to make this filter
    SETFILTER("No.",<>(filter entered by user));
    to calc another total,that's the point. :?:
  • kinekine Member Posts: 12,562
    What about not to filter, calc the total and subtract the first total? ;-)

    A = B + C => C = A - B
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • metarockmetarock Member Posts: 13
    the idea that i want to create filter like that "A<>(B | C)",and the result become like that"A<>B | A<>C"
  • matttraxmatttrax Member Posts: 2,309
    metarock wrote:
    "A<>(B | C)",and the result become like that"A<>B | A<>C"

    Remember, that actually equals (A <> B) AND (A <> C).

    Anyway, this is not a trivial task. Your users might not enter a filter like this:

    ((<>1000&<>2000)OR(<>3000&<>4000)) AND NOT (=2000 OR =5000)

    but what if they do. Do you really want to build a function to parse parentheses and properly negate everything?
    kine wrote:
    What about not to filter, calc the total and subtract the first total?

    I completely agree with Kine. Calculate your totals, once with the filters applied and once with no filters. The difference is the filters with the NOT at the beginning.
  • metarockmetarock Member Posts: 13
    I agree too with kine, but i steel have poblem :
    onlookup (total calcul)
    IF FORM.RUNMODAL(FORM::"Item List",recItem) = ACTION::LookupOK THEN
    VALIDATE("No.",recItem.No.);
    i need to applie the filter with "recItem"
  • kinekine Member Posts: 12,562
    I know that this is not good for performance (it leads to FULL SCAN), but one kind of solution:

    Mark all record. Apply filter, unmark filtered records. Clear the filter, filter only on marked records. You are done.

    !!!Once again - think about the performance, you need to read ALL records in this solution!!!
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kinekine Member Posts: 12,562
    Or you can just color the items within the filter to show user that these items are the one within the filter...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • metarockmetarock Member Posts: 13
    ths,nice work :D
Sign In or Register to comment.