Error when filtering on option/enum field in query
Please include the following with each issue:
1. Describe the bug
Issue 348390 (solved in NAV 2013 - build 34904) is back in BC 17 and BC 18
The "You have not yet retrieved a data row for this query. The value for column " error message is received when you set a filter, for example SETRANGE, for an option field in a query
The issue was already logged on colaborate but it was requested to log it here.
2. To Reproduce Steps to reproduce the behavior:
Execute the DoTest action on the page "My Test Page".

The following line causes the error:
QuantityPerZoneType.SetRange(ZoneType, QuantityPerZoneType.ZoneType::Receipt);
3. Expected behavior It should be possible to filter on an option/enum field even when the query has not been read. Similar as with record variables.
4. Actual behavior
The Web Client crashes when the DoTest action is executed:

5. Versions:
- AL Language:
- Visual Studio Code:
- Business Central:
- List of Visual Studio Code extensions that you have installed: Only AL Language
Final Checklist
Please remember to do the following:
-
[x] Search the issue repository to ensure you are reporting a new issue
-
[x] Reproduce the issue after disabling all extensions except the AL Language extension
-
[x] Simplify your code around the issue to better isolate the problem SampleQueryFilter.zip
Hi @daansaveyn,
I encountered similar problem today.
Situation:
- Query with Option-fields
- Filter query on some of those option fields, and by filtering on the required option-value:
- By replacing the option "Document Type" by an enum, it's not possible anymore to filter the query in the same way.
Solution:

I expected at least an error during building... In fact I expected any breaking change by replacing the option by an enum...
Hi! Thank you very much for raising the issue! Could you please provide a self-contained project that reproduces this problem?
Hi! Thank you very much for raising the issue! Could you please provide a self-contained project that reproduces this problem?
Hello. Please see SampleQueryFilter.zip above.
Sorry, my eyes skipped over that line. Thank you!
The Option case here does not seem to crash anymore, with either SetRange() or SetFilter(), e.g.:
pageextension 50100 Test extends "Customer List"
{
trigger OnOpenPage()
var
BankRecMatchCandidates: Query "Bank Rec. Match Candidates";
begin
BankRecMatchCandidates.SetFilter(Rec_Line_Type, '%1|%2', BankRecMatchCandidates.Rec_Line_Type::"Bank Account Ledger Entry", BankRecMatchCandidates.Rec_Line_Type::"Check Ledger Entry");
Message('OK!');
end;
}
Does it still, for anyone else? Please post a minimal sample if so ;-)
There is https://github.com/microsoft/AL/issues/6864 for Enum fields, but I can't replicate that with a simple case either.
We had the same problem for Enum Filtering only 2 months ago with Version 21.2