How to filter date range on field CreatedDateTime in AX

Hii Master,

 

How to filter date range on field CreatedDateTime in AX. ?

I'm trying to convert fromDt & toDate from TransDate to utdDateTime, and I insert fromDtConvert into range but I got Error (Like Pic 2).

Please advise, thank you

this's my code.

Pic 2

 

  • Which line of code is causing that error?
  • In reply to Kranthi:

    When I fill date (from & to) and click OK, I got the debug view

    Like this,

    What kind of code is actually for the createdDateTime column filter ? I've tried converting from TransDate to UtcDateTime but still error (I always get the debug view)

    Please advice, thanks

  • In reply to Pranyoto:

    The issue seems to be with setting the parameter but not with the filtering.
    Check the data types you are using in data contract class (or) show us your methods in contract class (including class declaration).
  • In reply to Kranthi:

    I just wanna, How can i use filter TransDate (data type) on createddatetime field ?

    does for filter createddatetime have to use utcdatetime data type ?

     

  • In reply to Pranyoto:

    Pranyoto
    does for filter createddatetime have to use utcdatetime data type ?

    Not necessary. You can still use from and to as the date types and convert them to utcDateTime while applying the range.

    You have done it right initially. 

  • In reply to Kranthi:

    while currently, I use utcdatetme data type for parameter 

    yaa maybe, i will try it with this code

     ---------------------------------------------------------------------------

    static void ConvertDate2DateTime(Args _args)

    {

       TransDate       fromDate,toDate;

       TimeZone        tz;

       UtcDateTime     fDateTime,tDateTime;

       ;

       fromDate    = mkDate(01,06,2017);

       toDate        = mkDate(30,06,2017);

       fDateTime   = Global::datetobeginUtcDateTime(fromDate,tz);

       tDateTime   = Global::datetoendUtcDateTime(toDate,tz);

       print fDateTime;

       print tDateTime;

       pause;

    }

    Ref: 

Related
Recommended