Search code examples
axaptadynamics-ax-2012dynamics-ax-2012-r3

Join table on executeQuery AX 2012


How can I join the SalesQuotationLine, CustTable and CustTrans on SalesQuotationTable executeQuery() method?

I need to join multiple tables on SalesQuotationTable -> executeQuery() method for me to get the filtered data (data to be display must not exceed on credit limit)


Solution

  • I don't think you will be able to put the logic of calculating the total amount of a quotation into a single query, let alone comparing it and the open transaction amount (which also has to be calculated) against the credit limit of the customer.

    Instead I propose the following solution: Dynamically add a temporary data source of table TmpRecIdFilter to the query, linked on field RefRecId to the RecId of the SalesQuotationTable datasource. Fill the RefRecId field with the RecId values of the SalesQuotationTable records that you want to filter. Without the constraint of a query it should be pretty straightforward to come up with a logic that can determine the SalesQuotationTable that do not exceed the credit limit.