Year field in Table

snehalppatelsnehalppatel Member Posts: 34
Hello All,

For one of the requirement, I need to add a Year field in the table. What is the easiest way to accomplish the task. I will also show this field on the form, from where user will enter the Year. What datatype is preferable, and how to format it?

Thanks in Advance.
Snehal Kumar Patel
MCTS - Microsoft Dynamics NAV

Answers

  • kish2007kish2007 Member Posts: 64
    use year data type as integer. what is the issue to creating the year field in a table???



    Regards,
    kishore...
  • snehalppatelsnehalppatel Member Posts: 34
    The issue is, i want to allow users to only enter four digits for year, not less than four digits.
    kish2007 wrote:
    use year data type as integer. what is the issue to creating the year field in a table???



    Regards,
    kishore...
    Snehal Kumar Patel
    MCTS - Microsoft Dynamics NAV
  • SavatageSavatage Member Posts: 7,142
    how about on validate of the year field
    Length := STRLEN(YEAR)
    if Length <> 4 then ERROR('Invalid Year');
  • David_SingletonDavid_Singleton Member Posts: 5,479
    FIrstly there is not enough information here to say if you should use a DATE, CODE or INTEGER field. But assuming you go for Integer, just set the property MINVALUE=1900 and MAXVALUE=2100 or something like that.
    David Singleton
  • mihail_kolevmihail_kolev Member Posts: 379
    why not option field?? with option string=1900,1901... .. .. .. ...2049,2050
    -Mihail- [MCTS]
  • David_SingletonDavid_Singleton Member Posts: 5,479
    why not option field?? with option string=1900,1901... .. .. .. ...2049,2050


    Because it would be pretty much unusable.
    David Singleton
  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'NAV 2009' forum to 'NAV/Navision' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • jversusjjversusj Member Posts: 489
    FIrstly there is not enough information here to say if you should use a DATE, CODE or INTEGER field. But assuming you go for Integer, just set the property MINVALUE=1900 and MAXVALUE=2100 or something like that.

    i needed to create a report request form once where the user just wanted to key in a year and this is precisely what i did. i set it to integer and entered MIN MAX values. I do recall that i then had to do some other code to make the "year" usable when setting the data filters, but it wasn't very complicated.

    it worked fine.
    kind of fell into this...
Sign In or Register to comment.