Community
Showing results for 
Search instead for 
Do you mean 
Reply

Default Value on DateTime

Bronze Super Contributor
Posts: 1,231
Country: USA

Default Value on DateTime

 

Is there any way to set the default datetime value to 'Today' when creating a new record in a custom table?

 

It would be very nice if the FieldDescriptor would allow a DefaultValue attributes. Such as:

Me.FieldDescriptor.Attributes(Act.Framework.Database.FieldProperty.DefaultValue) = New Act.Framework.Database.DefaultValueAttribute("Today")

 

Can anybody think of way to achieve this without storing the "Today" value outside the ACT DB?
It needs to be able to sync to remotes and be backed up with the DB.

 

I don't think I can store it in the preferences since they would be user specific.

 

Thanks

-- Jim Durkin

Silver Super Contributor
Posts: 2,328
Country: USA

Re: Default Value on DateTime

Jim,

 

I'm not sure I understand what the goal is.  Do you want the characters "Today" to show up in the field as a selection for the end user?  If so then you could just create a custom control that would do it or am I missing something?


Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Default Value on DateTime

I want the date field to default to todays date rather the System.DbNull.value when the user creates a new record in a cusotnm table. Or in the parent entity tables for that matter.

 

#09/09/2011 10:00 PM#

 

-- jim

 

 

Silver Super Contributor
Posts: 2,328
Country: USA

Re: Default Value on DateTime

So if I understand correctly you want an attribute on a date field for "Today" that automatically sets it to today's date?  That would be handy.  While they're at it they probably should have a "Now" attribute for date and time.

 

Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Default Value on DateTime

Yes exactly. It would be nice if they enumed it also. Such as...

 

DefaultDateValue.Date

DefaultDateValue.DateTime

DefaultDateValue.Time

DefaultDateValue.Null

 

I would be extremely helpful if we could use the enums DefaultDateValue.Null instead of the nullable date value  in .NET

 

VB

Dim ReturnDate AsDate? = Nothing

 

C#

System.DateTime? ReturnDate = null;

 

Feature request please!

 

-- Jim Durkin