Wednesday, June 8, 2022

Get SQL statement of your X++ Query

Hi All,
This blog will help us to get the SQL statement of your X++ query.

generateonly you need to extend your x++ select with generateonly command that will generate the query before it execute.

Expected result 













X++ Code

Create one runnable class (TestGetSQLStatementOfXPlusPlusQuery) and add below code to test.

internal final class TestGetSQLStatementOfXPlusPlusQuery
{
    public static void main(Args _args)
    {
        VendTable   vendTable;

        select generateonly firstonly AccountNum, Party from vendTable
            where vendTable.AccountNum == 'Test123';

        info(vendTable.getSQLStatement());    

    }
}

No comments:

Post a Comment

How to access extension class method on data entity field property

How to Use Extension Class Methods on Field Properties of Data Entity How to Use Extension Class Methods on Fie...