Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 73760

X++ Query using multiple tables (2 or more) querying using multiple fields from any table set.

$
0
0

I need to retrieve data from an AOT query (PurchTableDocument) in X++:

Against the query, I will dynamically pass 2 or more tables (depending on how many more tables are added to the query object).

Right now, the query retrieves data from PurchTable and PurchLine...for the case in purpose, I need to be able to pass as many conditions as I want (dynamically, from another method) and when I build the query in X++ in need to pass the conditions to retrieve results...for example, this is what I will provide:

1) PurchTable , PurchId == '00004' AND

2) PurchTable , DocumentSate == 'Approved' AND

3) PurchTable , PurchId == '00004' OR

4) PurchLine , QtyOrdered >= 10000 AND

5) PurchLine , CretaedDateTime > '12/26/2012'

Then...I'd like to set arrange (or something like that that) could do something like this:

qbds = query.addDataSource(' (PurchTable.PurchId == '00004' && PurchTable.DocumentSate == 'Approved' && PurchTable.PurchId == '00004') OR (PurchLine.QtyOrdered >= 10000 && PurchLine.CretaedDateTime > '12/26/2012'));

Ideally, I pass all this conditions for the 2 tables and different fields only once, make one trip to the database and test if ALL of them came back true (a recordset matched the criteria).

Is this even possible or how can I approach this problem ?

Thanks in advance for your kind attentions....(I hope I was clear enough).

 


Viewing all articles
Browse latest Browse all 73760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>