Filtering Table Box Data

JAKAJAKA Member Posts: 18
Hello.

I need to filter data shown on a table box according to the data retrieved.

Simple example: I have a form linked to Table Sales Invoice Header and a Table Box.
I would like to see only the records where Sell-to Customer No. <> Bill-to Customer No.
I tried to add filter to Form On_Init (and other triggers too)
SETFILTER("Sell-to Customer No.", '<>%1', "Bill-to Customer No.");

But this has no effect. Is this just too simple or am I looking from a wrong point of view?

Answers

  • garakgarak Member Posts: 3,263
    edited 2008-11-13
    Sorry, here NAV works a little bit different as, for example SQL.
    The filter setfilter(Field,'<>%1',Field2); //Field2 <- must have a value it's not dynamic (not so simple).

    So for your solution you must go through (loop) the rec's.
    The Recs, where Sell-to Customer No." <> "Bill-to Customer No." you store (for example in a temporary table, don't use mark if you have many records in your table and you are under sql) and after your loop you show the founded records.

    Regards
    Do you make it right, it works too!
  • kapamaroukapamarou Member Posts: 1,152
    You cannot do this with a variable or a function without using either a temporary table or something like MARK. To apply directly a filter it must be a Table field...

    You could add a flowfield that returns the equation and filter on that...
  • JAKAJAKA Member Posts: 18
    Thank you garak and kapamarou!

    My actual task was a bit different from my example but you helped me to see what the problem is. I finally added a field to source table, evaluated my comparison to it and filtered by this new field.

    I'm not totally comfortable with this but it does what I wanted. :wink:
Sign In or Register to comment.