web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Query extended range failure: Syntax error near 257

(0) ShareShare
ReportReport
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.

I have the same question (0)
  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    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.

  • AXDev2105 Profile Picture
    10 on at

    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?

  • Verified answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    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
    10 on at

    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
    8,826 Moderator on at

    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 549 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans