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 :
Microsoft Dynamics AX (Archived)

Auto generate code

(0) ShareShare
ReportReport
Posted on by 159

Hi everyone,
can you tell me, is it possible to see code  behind the UI Query. When I create Query like this, I want Axapta to make my code automatically.
6445.axView.JPG

*This post is locked for comments

I have the same question (0)
  • Crispin John Augustine Profile Picture
    37,081 on at

    Make a Job,

    Query query =  new Query(queryStr('Z_PurchCubeHVP'));

    info(query.toString());

  • Vladislav Profile Picture
    159 on at

    Hi Crispin ,

    This is result from job

    infolg.JPG

    I want something like this or what can I do when I know object's  reference?

    This is sample:

    public void runMyDynamicQuery2()
    {
        Query q;
        QueryRun qr;
        QueryBuildDataSource qbd;
        QueryBuildRange qbr;
    
        q = new Query();
        qbd = q.addDataSource(TableNum(CustTable));
    
        qbr = qbd.addRange(FieldNum(CustTable, AccountNum));
        qbr.value(">=4000"); // Default operator is ==.
    
        qbr = qbd.addRange(FieldNum(CustTable, AccountNum));
        qbr.value("<=4022");
    
        qbd.addSortField(FieldNum(CustTable, DlvMode));
    
        qr = new QueryRun(q);
        qr.prompt();
    
        pause;
    }

    Thank you !

  • Verified answer
    Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    What Crispin meant was query.dataSourceNo(1).toString(). But I'm not sure if it's related to what you want.

    Note that no X++ code is generated for AOT queries, but you can create an instance (with new Query(queryStr(Z_PurchCubeHVP))) and use the usual code to add data sources, modify ranges etc.

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans