How to get the first and last value using x++

Hi everyone, please help me.

I have created a report on HR Module AX 4.0,

NAME Startdate EndDate Duration

—on my code i have group the Employee by Employee id, however on those transactions…i need to get the firstdate of the StartDate from each employee id, and its last value as well so i could compute the number of day the employee was present. on a given range of time. When i use firstonly on my select query it only returns One (1) itemid only when it should return more than one different itemid. i hope you could help me on this guys…

i would appreciate any help…thanks in advance.

Hi,

You should have a look at the date functions in the global and DateTimeUtil classes, datetimeUtil::getDifference(date1, Date2) for exemple

Regards,

Thomas