23
from https://github.com/microsoft/AL/issues/6486 - this and my support ticket via partner were closed, the latter claiming this would be by-design, but I want some more eyes on it, or at least votes indicating the 'design' is absurd ;-)


**Describe the bug**
Setting filters in group -1 where one or more of the ORd fields is a FlowField does not work (properly).

**To Reproduce**

Run the below. If need be, create a new `Customer` whose `Balance (LCY)` (a FlowField) is `0`.

Click the new `Process`/`Test` action. See that, although we verify that `Balance (LCY)` is `0`, the filter that should mean '`Name` is empty (false) OR `Balance (LCY)` is 0 (true)` does not work: the `FindFirst()` throws an error because no record is found.

Yet... We just verified that it exists.

The resulting error does not acknowledge that any filter was even set on `Balance (LCY)`:
![image](https://user-images.githubusercontent.com/63455896/109033145-3df0ff00-76be-11eb-9513-0b84e36539d5.png)

...whereas if putting multiple Normal fields in `FilterGroup(-1)`, it would recite them all:
![image](https://user-images.githubusercontent.com/63455896/109033301-6973e980-76be-11eb-9a1e-5f21e6ab7e1f.png)

So clearly something is going wrong here, and the FlowField is just being ignored, not ORd.

```al
pageextension 50100 CustomerListExt extends "Customer List"
{
actions
{
addfirst(processing)
{
action(Test)
{
ApplicationArea = All;
Caption = 'Test';
Image = TestDatabase;
Promoted = true;
PromotedCategory = Process;
PromotedOnly = true;
ToolTip = 'Run the test.';

trigger OnAction()
var
Customer: Record Customer;
begin
Rec.TestField("No.");
Rec.TestField("Name");
Rec.TestField("Balance (LCY)", 0);

Customer.SetRange("No.", Rec."No.");

Customer.FilterGroup(-1);
Customer.SetRange(Name, '');
Customer.SetRange("Balance (LCY)", 0);

Customer.FindFirst();
end;
}
}
}
}
```

**Expected behavior**
FlowFields in `FilterGroup(-1)` should be ORd with the other fields. If they are not supported here, that needs to be
- documented,
- a compile-time error so that no one else wastes their time debugging and figuring out a repro for this, and
- ideally fixed later.

**5. Versions:**
- AL Language: 6.5.413786
- Business Central: Version: GB Business Central 17.4 (Platform 17.0.21485.22158 + Application 17.4.21491.21531)
Category: Development
STATUS DETAILS
Needs Votes
Ideas Administrator

Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future. Best regards, Business Central Team

Comments

D

This should generate a runtime error at least, I've been butting my head against this wall for a long time.
Docs says this should work and code compiles and run with very unexpected results.

Category: Development

D

I have the below reply from MS. So, it is a known limitation, and they will be fixing the documentation to reflect that, and *maybe* allowing it to work as expected with FlowFields later, for which I'm sure upvotes here can help :-)

***

All you are stating it is true. FILTERGROUP(-1) does not work with FlowFields.
Let me try to write down the whole story.

The first time it has been reported, it was for NAV 2018 (version 11.x) with the following repro

[...]

And this was reported in February 2018 already.
The final answer from product group was
“ Currently searching into flowfields does not work for the QuickFilter search.
There are several complications in supporting that - especially that of performance, as the case insensitive search would perform very poorly and lock up the user's session in cases with semi-large data amounts.
We have slice […] [Search] Improved Search in Client
for this functionality, but it is currently not planned”

This means that we are talking, at the moment, of a documentation defect – as you also stated – in relation of FLOWFIELD(-1) behavior.
What I have done on your behalf, then, is to open a Document Defect to product group in order to have this fully documented in docs.onmicrosft.com.
Taking out from your suggestions, this is what has been escalated

FlowFields in `FilterGroup(-1)` should be ORd with the other fields. If they are not supported here, that needs to be
- documented,
 This is the current TFS entry filed on your behalf as Document Defect
- a compile-time error so that no one else wastes their time debugging and figuring out a repro for this, and
 This was already opt-out by server runtime team since it would require quite some time and refactor (and would be a waste of time if resolved later on)
- ideally fixed later.
 This is related to the IDEA to be voted, together with the internal slice open since version 11.x

Stated the above, then, I will keep you posted on the documentation defect and its progress

Category: Development

D

If changing this behaviour is not possible can we at least get the documentation updated to reflect this. Like what flowfield types will this work with, if any? I think it worked for Lookup flowfields but not SUM, but I don't know if that is still the case in the latest version.

Category: Development