microsoft / microsoft/AL

Error when filtering on option/enum field in query

Open
#6,598 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PowerShell
Stars
881
Forks
285
Avg merge
3d 36m
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by opening SampleQueryFilter.zip and reproducing the DoTest action on My Test Page with the shown SetRange call. Trace the query and option/enum filtering behavior before a row is read; done means the filter executes without the Web Client crash and supports the expected pre-read behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
vscode
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.