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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

RDP with AOT query in Ax 2012 r3

(0) ShareShare
ReportReport
Posted on by 56

HI al,

i have made SSRS report RDP based with Query

[
    SRSReportQueryAttribute (querystr(GDJ_JPN_VendQR)),
    SRSReportParameterAttribute(classStr(GDJ_JPN_VendorTransactionContract))
]
class GDJ_JPN_VendorTransactionDP extends SrsReportDataProviderPreProcessTempDB
{
}

i have mentioned Query here

ProcessReport method

[SysEntryPointAttribute(false)]
public void processReport()
{
    ;
    contract = this.parmDataContract() as GDJ_JPN_VendorTransactionContract;

    if(contract)
    {
        fromDate    = contract.parmfromDate();
        toDate      = contract.parmtoDate();

        this.insertDataTmpTable(fromDate,toDate);
    }
}

InsertDataTempTable method

public void insertDataTmpTable(transdate   _fromDate,
                        transdate   _toDate)
{
    VendTrans   vendTransOpng;

    boolean     flag;
    query = new query();

    qbds    = query.addDataSource(tableNum(VendTrans));
    qbds.relations(true);

    // date range mapping
    if(_fromDate && _toDate)
    {
        qbds.addRange(fieldNum(VendTrans,TransDate)).value(queryRange(_fromDate, _toDate));
    }

    qbds.addRange(fieldNum(VendTrans,AccountNum)).value();

    qr = new QueryRun(query);

    while(qr.next())
    {
        vendTrans = qr.get(tableNum(VendTrans));
    }
}

here in dialog i am given 

3113.vendor.jpg

Note - date filter is working fine BUT the Vendor account which i am given in query is  NOT  FILTERING data based on vendor.

Please let me know how to resolve ?

please give me more shed on this.

thanks!

I have the same question (0)
  • @rp@n Profile Picture
    56 on at

    I have modified the insertTempTable method

    public void insertDataTmpTable(transdate   _fromDate,
                            transdate   _toDate)
    {
        VendTrans   vendTransOpng;
    
        boolean     flag;
        
        query = this.parmQuery();
        
        qbds    = query.addDataSource(tableNum(VendTrans));
        qbds.relations(true);
    
        // date range mapping
        if(_fromDate && _toDate)
        {
            qbds.addRange(fieldNum(VendTrans,TransDate)).value(queryRange(_fromDate, _toDate));
        }
    
        qbds.addRange(fieldNum(VendTrans,AccountNum)).value();
    
        queryRun = new QueryRun(query);
    
        while(queryRun.next())
        {
            vendTrans = queryRun.get(tableNum(VendTrans));
        }
    
    }
    

    but still it's not FILTERING VEND ACCOUNT

  • @rp@n Profile Picture
    56 on at

    I debugged the query

    V2.jpg

    in the above query, i have required, the Vendor account which i am given in query that should match with VendTrans.AccountNum. So, that it will fetch the record based on ( date range + AccountNum ) from vendTrans.

    Please give me more shed on this.

    thanks!

  • Suggested answer
    udaY-ch Profile Picture
    5,175 on at

    Hi

    Is your query having vendtable as a single datasource?

    If not, then you need to use, query.datasourceno(1).adddatasource(your table) to make the right connection.

    Uday

  • @rp@n Profile Picture
    56 on at

    yes, single data source ( vend table )

  • Suggested answer
    udaY-ch Profile Picture
    5,175 on at

    Hi,

    Adding new data sources as a joining data source shouldn't be added directly to the query (query.adddataSource)

     public static void query(Args _args)
    {
        Query                   query;
        QueryRun                queryrRun;
        QueryBuildDataSource    qbdVendTrans, qbdsVendTable;
        QueryBuildRange         qbr;
        VendTrans               vendTrans;
    
        query = new Query(queryStr(Your Query));
    
        //Solution 1
        //qbdsVendTable = q.dataSourceTable(TableNum(vendTable));
        //qbdVendTrans = qbdsVendTable.addDataSource(TableNum(VendTrans));
        //or
        qbdVendTrans = query.dataSourceTable(TableNum(vendTable)).addDataSource(TableNum(VendTrans));
    
        //Solution2
        //qbdVendTrans = query.dataSourceNo(1).addDataSource(TableNum(VendTrans)); 
        
        qbdVendTrans.relations(true);
        qbdVendTrans.joinMode(JoinMode::InnerJoin);
    
        qbr = qbdVendTrans.addRange(FieldNum(VendTrans, AccountNum));
        qbr.value("1000000");  
    
        queryrRun = new QueryRun(query);
    
        while (queryrRun.next())
        {
            vendTrans = queryrRun.get(tableNum(VendTrans));
            info(strFmt("%1", vendTrans.AccountNum));
        }
    }

    Uday

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 653

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 501 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 298

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans