I am using Axapta 4.0 and want to see what SQL Statement is generated out of my x++ code.
How can I see the generated SQL Statement ?
Some background so you might understand why I want to see the code. My X++ Sourcecode compiles but during execution I get the message that it can't join the tables because the where clause is wrong (not matching). I looked it up in the AOT and it matches.
I read this how-to-see-the-sql-expression-of-an-x-select-statement but it seems that it only applys to AX2012 and not Axapta4.0
I have the big statement which isn't working here
select *
FROM ltabInventTable
join * FROM ltabModelList
where ltabModelList.ItemId == ltabInventTable.ItemId
&& ltabModelList.IsAssortment == 0
join * FROM ltabInventTableModule
where ltabInventTableModule.ITEMID == ltabInventTable.ITEMID
&& ltabInventTableModule.ModuleType == 1
join * FROM ltabCharValue
where ltabCharValue.CHARACTERVALUE == ltabModelList.MODELLCONFIGID
join * FROM ltabBarcodes
where ltabBarcodes.ITEMID == ltabInventTable.ITEMID
join * from ltabInventDim
where ltabInventDim.INVENTDIMID == ltabBarcodes.InventDimId
join * FROM ltabConfigTable
where ltabConfigTable.ITEMID == ltabBarcodes.ITEMID
&& ltabConfigTable.CONFIGID == ltabInventDim.CONFIGID
&& ltabConfigTable.MODELCONFIGID == ltabModelList.MODELLCONFIGID
outer join ltabPriceDiscItemResult //IN HERE WE HAVE THE PROBLEM
where ltabPriceDiscItemResult.ITEMID == ltabModelList.ITEMID
&& ltabPriceDiscItemResult.MODELCONFIGID == ltabModelList.MODELLCONFIGID
&& ltabPriceDiscItemResult.SIZEID == ltabModelList.SizeID;
And I have a smaller version which works.
SELECT * FROM ltabModellist //AWESOME THIS WORKS
outer join ltabPriceDiscItemResult
where ltabPriceDiscItemResult.ITEMID == ltabModelList.ITEMID
&& ltabPriceDiscItemResult.MODELCONFIGID == ltabModelList.MODELLCONFIGID
&& ltabPriceDiscItemResult.SIZEID == ltabModelList.SizeID;
The smaller version is joining exactly like the bigger one but the bigger one is throwing an error.
Edit:
The error message was requested. The problem is that the error is only in german. i will provide both the german error message and the google translation of it.
Original:
Ein Datensatz in Resultat Preisabschrift (PriceDiscItemResult) kann nicht ausgewählt werden. Der Join enthält in der WHERE-Klausel keine Verknüpfung zwischen den Join-Tabellen.
Google translation:
A record in result pricemarkdown (PriceDiscItemResult) can not be selected. The join in the WHERE clause contains no link between the join tables.