Blank value of a flowfilter

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

0
Answers
-
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
Cheers0 -
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
2 -
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 day0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions