0

How can one group by a table based on only the date part of the CreatedDateTime field in X++ in dynamics AX? I can use the following statement in the sql server and get what I want but I don't know the way to do same in X++.

select  COUNT(RECID) from WMSORDERTRANS
GROUP BY CAST( FLOOR( CAST( CREATEDDATETIME AS FLOAT ) ) AS DATETIME )

In X++ I tried, DateTimeUtil::date(wmsOrderTrans.CreatedDateTime) but I cannot use it in while select statement.

1 Answers1

2

It is not possible to group on a calculated field in AX.

You can create a view then make a computed field, see this answer.

By the way, this is the correct way to convert to local date.

Community
  • 1
  • 1
Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50