5
Users facing issues when using dynamic range values on the views.
When we use a expression (GreaterThanDate(-1000)) Database is not taking values dynamically. It picks the value from last DB synchronization.

Example:
a. Create a new view.
b. Use CustTrans table as a datasource.
c. Include AccountNum and TransDate fields in the view.
d. Include TransDate as a range field.
i. Value = (GreaterThanDate(-1000))
e. Perform Build and DB Sync

3. Login to SSMS
4. Go to AxDB > Views > dbo.PAV_CUSTTRANSVIEW > right click Design.
5. We see that the transdate is being filtered for 01st May 2018. is ONLY correct for 25.01.2021. But for dates after today the value is incorrect. The correct date for 27.01.2021 will be the 03rd May 2018 but the value in the SQL view will NOT change.


Expected result.
Dynamic range values should be updated without performing Database synchronization.
Category: Development
STATUS DETAILS
Needs Votes

Comments

P

That's the expected behavior. GreaterThanDate() is an X++ method returning a range value, and when you use it in a view definition, it's called when the view is created, i.e. during DB synchronization.
What you ask for is that if you use this X++ function in a view definition, there should be something translating its X++ code to T-SQL. Not only it would be difficult, but it's simple to create a range util method that can't be translated to T-SQL at all.
In your case, the right approach is using GreaterThanDate() in a query selecting data from the view, not in the view itself.
Nevertheless having an ability to add ranges like this to views would be useful. It can't be based on generic X++ code; I would rather consider something similar to computed columns.

Category: Development