AL icon indicating copy to clipboard operation
AL copied to clipboard

Error when filtering on option/enum field in query

Open daansaveyn opened this issue 4 years ago • 6 comments

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

image

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

5. Versions:

  • AL Language: image
  • Visual Studio Code: image
  • Business Central: image
  • 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

daansaveyn avatar Apr 28 '21 09:04 daansaveyn

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: image
  • By replacing the option "Document Type" by an enum, it's not possible anymore to filter the query in the same way. image

Solution:

image

I expected at least an error during building... In fact I expected any breaking change by replacing the option by an enum...

gvae avatar Apr 28 '21 15:04 gvae

Hi! Thank you very much for raising the issue! Could you please provide a self-contained project that reproduces this problem?

atoader avatar Apr 29 '21 09:04 atoader

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.

daansaveyn avatar Apr 29 '21 09:04 daansaveyn

Sorry, my eyes skipped over that line. Thank you!

atoader avatar Apr 29 '21 11:04 atoader

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.

dzzzb avatar Dec 08 '21 13:12 dzzzb

We had the same problem for Enum Filtering only 2 months ago with Version 21.2

pri-kise avatar Feb 20 '23 06:02 pri-kise