简体   繁体   中英

Very quick select statement in AX2012

What's your method of quickly viewing results of such statements?

SELECT * FROM CustInvoiceJour`
JOIN CustInvoiceTrans WHERE CustInvoiceJour.InvoiceId == CustInvoiceTrans.InvoiceId`
WHERE CustInvoiceTrans.ItemId == 'MBIIRKT0014'

I'm looking for something like table explorer, but supporting joins.

If this is just for quick data checks, I just usually use info(strFmt(...)); statements to output what I need to see.

Another way, if you're stronger in SQL is to actually use SQL . You can use the keywords generateonly and forceLiterals to generate the SQL statement and force literal values.

Here is your AX SQL statement rewritten:

SELECT generateonly forceLiterals * FROM CustInvoiceJour
    JOIN CustInvoiceTrans
    WHERE CustInvoiceJour.InvoiceId == CustInvoiceTrans.InvoiceId   &&
          CustInvoiceTrans.ItemId == 'MBIIRKT0014';

info(CustInvoiceJour.getSQLStatement());

Then you can run that SQL in SQL and do what you need.

Your X++ select has two WHERE 's in it and is malformed, but I fixed it.

If you need to make joins In my case I create a simple View object .

Table CustInvoiceJour principal and then joins to CustInvoiceTrans

Views located in AOT/Data Dictionary/Views

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM