Blank value of a flowfilter

poppinspoppins Member Posts: 647
Hi everyone,

I am trying to filter on a lookup of a field fieldXXX: the values displayed on lookup are filtered when opening the page.
I created a flowfilter fieldXXXFilter on the same table and changed the table relation of fieldXXX as following:
TableXXX where Code=fieldXXXFilter
and I created a function GenerateFilter() to generate the value for fieldXXXFilter.
It is working fine, except when GenerateFilter() returns a empty text, then the lookup displays everything as if no filter was applied.
I want that when GenerateFilter() returns a empty text, the lookup gives nothing.
How shall I do it?
Here is my code for GenerateFilter():

GenerateFilter(pType:Option)
WITH TableXXX DO BEGIN
RESET;
CLEAR(DocFilter);
SETRANGE(Type,pType);
IF FINDSET THEN BEGIN
REPEAT
IF STRLEN(DocFilter+Code)+1 > 1024 THEN BEGIN
DocFilter := '';
EXIT;
END;
IF DocFilter <> '' THEN
DocFilter += '|';
DocFilter += Code;
UNTIL NEXT = 0;
END;
END;
EXIT(DocFilter);

Any ideas?
Thanks in advance :smile:

Answers

  • martonnmartonn Member Posts: 29
    The problem is with this that in NAV if the Filter value is empty it means no filter so you will filter for empty.
    Instead of this line:
    DocFilter := '';

    Define a new TextConstant called EmptyFilter (for example) and give it this value : ''
    And use it in you code like this:
    DocFilter := EmtpyFilter

    Cheers
  • parmparm Member Posts: 49
    Hi,
    If I understood correctly you want to show no records in the lookup when the filter is empty. You can achieve this with a simply dummy filter like "=1&<>1"
    This always return zero records (equal to one and different than one). The same could be applied to text, date, boolean.

    Regards,

    parm

  • martonnmartonn Member Posts: 29
    parm wrote: »
    Hi,
    If I understood correctly you want to show no records in the lookup when the filter is empty. You can achieve this with a simply dummy filter like "=1&<>1"
    This always return zero records (equal to one and different than one). The same could be applied to text, date, boolean.

    Regards,

    parm

    Cool :)
    You can learn new things every day
Sign In or Register to comment.