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