tsql - Dynamics AX 2009: Or Exist Join in QueryBuildDataSource -
want use or exists clause in querybuilddatasource dont know how use it.
prepare sql query:
select * ledgerjournaltable l ( l.createdby = '...' , l.workflowstatus != 99 ) or exists ( select top 1 'x' workflowworkitemtable w l.recid = w.refrecid , w.reftableid = 211 , w.userid = '....' )
and try build ax query
queryds = ledgerjournaltable_ds.query().datasourcetable(tablenum(ledgerjournaltable)); ledgerstatusfilter = queryds.addrange( fieldnum(ledgerjournaltable,workflowstatus) ); ledgeruserfilter = queryds.addrange( fieldnum(ledgerjournaltable,createdby) ); ledgerstatusfilter.value( "!=99" ); ledgeruserfilter.value( "..." ); qbdsworkitemttable = queryds.adddatasource( tablenum(workflowworkitemtable) ); qbdsworkitemttable.joinmode( joinmode::noexistsjoin ); qbdsworkitemttable.addlink( fieldnum(ledgerjournaltable,recid), fieldnum(workflowworkitemtable,refrecid) ); qbdsworkitemttable.addrange( fieldnum(workflowworkitemtable,reftableid) ).value( strfmt("%1",tablenum(ledgerjournaltable))); workflowuser = qbdsworkitemttable.addrange( fieldnum( workflowworkitemtable, userid ) ); workflowuser.value("..."); info( strfmt("%1", queryds.tostring() ) );
sory bad english :c
sorry, ax queries not support or exists
.
also see similar question.
Comments
Post a Comment