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