Date Field

Is it possible to create a date field in Nav that is formatted to date and month only.

I want to add a birthday field to the contact table and have it set to only DD/MM or MM/DD

Is this at all possible.

Thanks

James

Well. Yes and no. If you add a standard Date-field to the table, then it is also entered with a year. Then on display you can use

FORMAT(Date,0,’<Day,2>/<Month,2>’).

Hi Erik

Thank you for responding, when you say I can format the display, how do you do that? I assume you mean when I add the field to the page?

Sorry I am new to all this

Thanks

James

In your field-property on the form/page, there is a property called Format. Write “<Day,2>-<Month,2>” (without quotation-marks).

Beware:
A date-field in NAV will allways contain day, month and year. That property will only affect the visible part.

So if you enter “3108” today, the field will contain 31 aug 2015.
And if you next year enter “3108” , the field will contain 31 aug 2016.

But NAV will show you “31 aug” in both cases.

Hi Erick

Apologies, I am a little lost, I am on the object designer, i selected the page with the field in, selected design.

I then found the field, right clicked it and selected properties, this has given me a list of properties but i cannot see format in there.

I have attached a screen shot of what options i have, can you let me know which one i should be selecting.

Hi Apologies

I have selected the properties of the field of the page, i could not see format, below are the properties, which one should i select?

Hi James,

That’s why you should ALWAYS write which version of Dynamics NAV your problem is about! [8-|]

The format options (onFORMAT trigger and the format property) only exists on FORMS, not for PAGES.

At least I haven’t found a way to do it.

So in that case, then I’ll suggest that you create two variables on your page, Day and Month (option fields with values 1-31 and 1-12). Initiate the variables via onAfterGetRecord. If the “fields” are changed, then update the actual date field from the variables onValidate trigger. Here you can also write a simple validations, so that February 31st is not possible.