0

I am using AOT query to create a view.Now I want to pass dynamic range to the AOT query which should affect the view also. I tried using TreeNode class to set query properties but it opened a compiler window and plus it throws error if accessed by two users at the same time.

Can anybody help?

user3805649
  • 19
  • 2
  • 6

3 Answers3

1

Depends on which version you are using. In AX 2009 and AX 2012 you can use methods existing in SysQueryRangeUtil class, ofcourse you can add your own. Methods can have arguments or not.

In AX 2012 see ProjTable_MyProjects Query in AOT as an example: Check the WorkerResposible Range

Queries\ProjTable_MyProjects\Composite Query\ProjTable_NoFilter\Data Sources\ProjTable(ProjTable)\Ranges\WorkerResponsible

there is a following range value

((WorkerResponsible==currentWorkerRecId()) && ... 

currentWorkerRecId() is the static method in SysQueryRangeUtil class:

public static HcmWorkerRecId currentWorkerRecId()
{
    return HcmWorker::userId2Worker(curUserId());
}

Regards, Sebastian

Sebastian Widz
  • 1,962
  • 4
  • 26
  • 45
0

You need to use a computed column in a view. There's a number of examples in standard AX 2012 views.

10p
  • 5,488
  • 22
  • 30
0

You can use the SysQueryRangeUtil class methods like:

currentCustomerAccount()
currentVendorAccount()
currentUserId()
currentDate()
dateRange()
day()
dayRange()
greaterThanDate()
greaterThanUtcDate()
greaterThanUtcNow()
lessthanDate()
lessthanUtcDate()
lessthanUtcNow()
monthRange()
yearRange()

regards