Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when filtering on option/enum field in query #6598

Open
3 tasks done
daansaveyn opened this issue Apr 28, 2021 · 6 comments
Open
3 tasks done

Error when filtering on option/enum field in query #6598

daansaveyn opened this issue Apr 28, 2021 · 6 comments
Labels
bug Product bug

Comments

@daansaveyn
Copy link

daansaveyn commented Apr 28, 2021

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 can only be accessed after a row is retrieved with a call to the READ function" 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:

  • Search the issue repository to ensure you are reporting a new issue

  • Reproduce the issue after disabling all extensions except the AL Language extension

  • Simplify your code around the issue to better isolate the problem
    SampleQueryFilter.zip

@gvae
Copy link

gvae commented Apr 28, 2021

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

@atoader
Copy link
Contributor

atoader commented Apr 29, 2021

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

@daansaveyn
Copy link
Author

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.

@atoader
Copy link
Contributor

atoader commented Apr 29, 2021

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

@dzzzb
Copy link

dzzzb commented Dec 8, 2021

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 #6864 for Enum fields, but I can't replicate that with a simple case either.

@pri-kise
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Product bug
Projects
None yet
Development

No branches or pull requests

5 participants