Friends,
To get the underlying SQL query or statement from the X++ query, use getSQLStatement method. getSQLStatement is a new method that has been introduced in tables in AX 2012.
The X++ select has been extended with the generateonly command that instructs the underlying data access framework to generate the SQL query without actually executing it.
static void SR_getSQLStatement(Args _args)
{
CustTable custTable;
CustTrans custTrans;
;
select generateonly firstOnly AccountNum, CustGroup
from custTable join custTrans where custTrans.AccountNum == custTable.AccountNum;
info(custTable.getSQLStatement());
}
Below is the SQL query.
Simple but very useful for developers for trouble shooting or to use it on reports.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.