I have a query and two datasources attached to it.Two datasources reference the same table.But both have different range values.

For Example:

Query has dataSources as CustTrans_1 and CustTrans_2.(Both reference CustTrans table)(Datasources are not joined).

CustTrans_1 has ranges as Approved = Yes and TransDate

CustTrans_2 has ranges as Approved = No and TransDate

Now I want to fetch the records which has (Approved status as ‘YES’ and TransDate <= 31-12-2011

) and

(records with Approved status as “No” and TransDate = 31-12-2012.)

Can Anyone help me on this please???



You need a Union query to add results of two queries together. Union queries are supported from version 2009, I think. Look at How to: Combine Data Sources in a Union Query [AX 2012].

If you’re writing such query in code, you can use a single datasource with both conditions in WHERE clause (separated by || operator).


Thanks for your reply.I will look into UNION queries.

But through code I need something like this

(Approved = Yes && TransDate) || (Approved = No && TransDate)

TransDate in both the cases differ.



Hi sidhu,

If you want your query in && or || condition then probably this site would help you :



Vishal Tiwari