Some Useful SysQuery Class Methods

 Ax 2012: Some useful SysQuery Class methods



Instead of direct assignment of the values to the query build range value, we can use SysQuery class methods to avoid the errors of datatype conversion. So here in this post I gave some useful methods.



QueryBuildRange qbr;


*   For setting range value we usually use like this


qbr.value(“Our Value”);


qbr.value(queryValue(“Our Value”));


*   For setting range value using SysQuery


qbr.value(SysQuery::value(“Our Value”));


qbr.value(SysQuery::valueLike(“Our Value”));


qbr.value(SysQuery::valueNot(“Our Value”));


*   For logical NOT


qbr.value(SysQuery::valueNot(“Our Value”));


*   For retrive all records


in usual way we can give like empty (” “) but using sysquery class


qbr.value(SysQuery::valueUnlimited());


*   For retrive Null records


qbr.value(SysQuery::valueEmptyString());


*   For retrive Not Null records


qbr.value(SysQuery::valueNotEmptyString());


*   For giving range


usually we add qbr.value(fromDate,toDate) but using sysQuery


qbr.value(SysQuery::range(fromDate,toDate);


The method will add the dots (‘..’)  like this


*   For finding total number of records available in the resulting query

info(strFmt(“%1”,SysQuery::countTotal(queryRun)));


*   For finding total number of Datasource available in the resulting query


info(strFmt(“%1”,SysQuery::countLoops(queryRun)));


*  For Datasource and Range creation


SysQuery::findOrCreateRange(parameter);


SysQuery::findOrCreateDataSource(parameter);


SysQuery::findOrCreateDataSourceByName(parameter);


 

Comments

Popular posts from this blog

How to Create a wizard in x++ d365

how to post trade agreement journals automatically using x++ code

X++ code to CREATE AND POST A TRADE AGREEMENT IN MICROSOFT DYNAMICS 365 in D365 F & O