Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Query extended range failure: Syntax error near 257

Posted on by 10

Hi everyone,

I am facing an issue.

I have a Policy on a Role.

I created an AOT Query for policy containing only one table InventTransferTable. And add a range on field InventLocationIdFrom.

For value of this range, I created a method in class SysQueryRangeUtil. 

I want to only filter those LocationId(s) from InventTransferTable which map the User assigned LocationId. (which come through loop)

Either this LocationId exist in InventLocationIdFrom field or it exist in InventLocationIdTo field. here is the code:

pastedimage1639744536173v1.png

Here is the AOT Query range image:

pastedimage1639744536174v2.png

So when I open the TransferOrder Form, this code generate the following error:

Query extended range failure: Syntax error near 257.

I tried different code but no result.

The main loop have 6 LocationId(s). On 2 to 3 LocationId(s), It did nót get any error.

For the User Assigned Location consider,  1,2,3,4,5,6

Need help for this. Your help will appreciable.

  • Verified answer
    ergun sahin Profile Picture
    ergun sahin 8,812 Super User 2024 Season 1 on at
    RE: Query extended range failure: Syntax error near 257

    Complex queries can be used but your situation was a little different. You cannot use a fixed value(build user values) because you are filtering on a user basis .

    In this case the mapping table is a good idea, but if you use the standard table and not fill it a tmp as I mentioned (XDS-tmpTable exampls), you will need to update the table data every time the user's location changes.

    I'm glad you fixed the problem. If you mark the helpful answers as verified, you will have closed the topic.

  • AXDev2105 Profile Picture
    AXDev2105 10 on at
    RE: Query extended range failure: Syntax error near 257

    Once again Thanx Ergün Şahin,

    You give me a direction to resolve this issue via another way.

    I implemented it, and achieved the desired results.

    My findings is, that never used complex ranges in AOT query values.

    I made a table and fill with desired data that I want to filter, and make the join of this table to InventTransferTable.

  • Verified answer
    ergun sahin Profile Picture
    ergun sahin 8,812 Super User 2024 Season 1 on at
    RE: Query extended range failure: Syntax error near 257

    If you look at the table I'm talking about (or any other table starting with my..), you'll see that it fills the table with codes. After this session-based filling process, records will be automatically filtered in the query when you join (inner join) this table.

    You need to look standard and set up a similar structure.

  • AXDev2105 Profile Picture
    AXDev2105 10 on at
    RE: Query extended range failure: Syntax error near 257

    Thank you Ergün Şahin for response.

    But I am not clear with your answer. e.g. what does you mean by examine MyDepartments temp table.

    Could you explain in some more detail?

  • Suggested answer
    ergun sahin Profile Picture
    ergun sahin 8,812 Super User 2024 Season 1 on at
    RE: Query extended range failure: Syntax error near 257

    I'm not an expert on XDS but aside from the errors in the codes, even if you solve the errors, it will work with the location information of the user who made the build.(it ll not dynamic)

    What you need to do is to examine the MyDepartments temp Table, make a similar table and fill it. You can use this structure to filter the query.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans