Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Date Value(01\01\1900) Ax 2012

Posted on by 286

Hi, Everyone

I have a requirement to set Date value as default in a table date field as 1\1\1900 but I have to try to create this value in the table this won't pick it up. Please see the below code and give any suggestion.

 CustomTable      custom;   // Table buffer creation
 date d;                 
 //Transdate   _date;
 ;

 ttsbeign;
 // _date = 01\01\1900;
    
 d = mkDate(1,1,1900);
 custom.DateValue  =  d;      // set date value to table date field
    
 //custom.DateValue = _date;
    
 custom.insert();               // insert operation perform
     
 ttscommit;

Thanks in Advance.


*This post is locked for comments

  • Peter John Profile Picture
    Peter John 286 on at
    RE: Date Value(01\01\1900) Ax 2012

    I have done this already but the answer is same now am I getting table does not get dateNull() value it only appears empty. One more point please find the below screenshot for your reference and also the point earlier Ievgen told above conversation

    Ievgen.png

  • Peter John Profile Picture
    Peter John 286 on at
    RE: Date Value(01\01\1900) Ax 2012

    Ya thank you Ievgen when I will get empty value it should assume as 1/1/1900 this value.

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: Date Value(01\01\1900) Ax 2012

    Hi!

    Why you can't use dateNull() ? You can use it in your logic. 

    The dateNull() method always return the value

    static date dateNull()
    {
        return 01\01\1900;
    }

    AX doesn't allow to assign null to date fields, it simply uses 01\01\1900 as a default value.

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Date Value(01\01\1900) Ax 2012

    Table browser is for developers only and users should not have access to it. And you as a developer should understand that empty date is 1/1/1900 without any changes.

  • Peter John Profile Picture
    Peter John 286 on at
    RE: Date Value(01\01\1900) Ax 2012

    You were right got the value in SQL Please find the below screenshot,

    but I have to appear on the table browser for the requirement to depends upon the value to do some logic's Please suggest what I have to do appear on the table browser ?? Please suggest

    6562.Sql.png

  • Peter John Profile Picture
    Peter John 286 on at
    RE: Date Value(01\01\1900) Ax 2012

    Ok I will try and let you know

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Date Value(01\01\1900) Ax 2012

    As I said before AX shows 1/1/1900 as an empty value, in SQL database it is stored as 1/1/1900 but in AX it shows as Empty! Go to SQL and check. You won't be able to see it in table browser.

  • Peter John Profile Picture
    Peter John 286 on at
    RE: Date Value(01\01\1900) Ax 2012

    I am using your code but Only got the Infolog and still, they are the same. Please find the below screenshot for your reference and suggest what can I do from here and I d'not know what I have to do 

    QuestionAsk1.png

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Date Value(01\01\1900) Ax 2012

    Go to database using SQL management studio and check what is there or use debugger. Because function that you use does not show this date, empty value in AX is 1/1/1900, so instead of 1/1/1900 you will see empty value everywhere in UI, but in SQL DB it would be 1/1/1900.

    You can do next:

    info(date2StrXpp(custom.DateValue));

  • Peter John Profile Picture
    Peter John 286 on at
    RE: Date Value(01\01\1900) Ax 2012

    Hi, ievgen.

    I have tried your words but again I cannot get the value see the below screenshots for your reference. Please give an suggestions

    QuestionAsk.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans