05.05.2011, 20:12 | #1 |
Участник
|
sumitsaxfactor: Using Methods Inside Query Range
Источник: http://sumitsaxfactor.wordpress.com/...e-query-range/
============== This article may be a little late. I had discovered this long time back for one of the usages but writing it down now. In class SysQueryRangeUtil you will find many static methods that can be used in a Range of a query. Following are the methods that be used:
Here is one such example: static void methodsInsideQueryRange(Args _args) { Query q = new Query(); QueryRun qr; QueryBuildDataSource qbds; str rangestr; ProjTable p; ; rangestr = ‘((Responsible == currentEmployeeId()) && (Responsible != ""))’; qbds = q.addDataSource(tableNUm(ProjTable)); qbds.addRange(fieldNum(ProjTable, Responsible)).value(rangestr); qr = new QueryRun(q); while (qr.next()) { p = qr.getNo(1); info(p.ProjId); } info(q.dataSourceNo(1).toString()); } This is how you use them in code. Now how is it useful in daily tasks? Think of a scenario where you have 100’s of transactions posted daily and say you want to filter out those transactions that have been posted in last two months? How will you filter them? Take all the transactions to excel and filter there? Hold on there is a better way to do it in AX 2009. On the required form press Ctrl + G and then in the filter use these methods: Ex: (monthRange(-2,0)). This means we need to filter all those transactions starting from 2 months behind and till today. If we specify (monthRange(-2,2)), this means all the transactions between 2 months backward and 2 months forward. Check the screen shots below: Here is a screen shot of Item transactions form before applying monthRange: After we apply the monthRange method filter: Источник: http://sumitsaxfactor.wordpress.com/...e-query-range/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|