Unexpected Query behaviour

前端 未结 1 1334
滥情空心
滥情空心 2021-01-16 09:22

I am trying to execute the following code:

static void ProjTableQuery(Args _args)
{
   Query query;
   QueryBuildDataSource qbds1;
   QueryBuildDataSource qb         


        
相关标签:
1条回答
  • 2021-01-16 09:55

    This hack is useful for understanding the SQL generated by a query:

    query.literals(true);
    info(query.datasourceNo(1).toString());
    

    Add the line before the while loop (maybe comment the loop out).
    The output will be an almost legal SQL statement (some X++ still shines through though).

    The corresponding hack for X++ gives the exact SQL statement:

    ProjTable projTable;
    select generateonly forceliterals from projTable 
        where ProjTable.Type == ProjType::FixedPrice;
    info(projTable.getSQLStatement());
    

    The output is fully legal SQL and can be copy/pasted to the Query Editor.

    0 讨论(0)
提交回复
热议问题