Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

AX - QueryService c#

Posted on by 900

Hi,

I am using AX query service to get data from ax. I have created AOT query and call using query service in console application. I need to use paging to get step by step data. I am using systems custTrans table with join of other table I have added extra field in AOT query.

Code :

 AdvancedValueBasedPaging advPaging = new AdvancedValueBasedPaging();
            Paging paging = advPaging;

            advPaging.RecordLimits = new DataSourceRecordLimit[] {
                new DataSourceRecordLimit() { DataSourceName = "CustTrans", RecordLimit = 3000 }};

            do
            {
                DataSet dataSet = new DataSet();
                dataSet = client.ExecuteStaticQuery("ISPLCustomerTransactionWithDimension", ref paging);
         
                int count = dataSet.Tables[0].Rows.Count;
            }
            // Check if the returned bookmark is NULL. If so, there is no more data to be returned.
            while (((AdvancedValueBasedPaging)paging).Bookmark != null);

Error :

“An unhandled exception of type 'System.ServiceModel.FaultException`1' occurred in mscorlib.dll

 Additional information: Cannot perform Value Paging - The Table doesn't have any Primary Key or Clustered Index specified on it.” - 

Please find attached screenshot of error.

7750.Untitled.png

CustTrans table already have Primary Key or Clustered Index.

Please do needful.

Thanks,

keyur shah.

*This post is locked for comments

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templates⚡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans