Community
Showing results for 
Search instead for 
Do you mean 
Reply

field.attribute(field.property(defaultvalue) = how to set

Avid Listener
Posts: 44
Country: USA

field.attribute(field.property(defaultvalue) = how to set

Looking for a hint on the proper syntax to set the default value for a string and a Y/N field using the SDK.

 

Thanks

DBS
Bronze Super Contributor
Posts: 1,231
Country: USA

Re: field.attribute(field.property(defaultvalue) = how to set

 

 

 Me.FieldDescriptor = New Act.Framework.Database.FieldDescriptor(sFieldName, sFieldName, EntityDescriptor, Act.Framework.Database.FieldDataType.Character)

 

'---------------------------------------

' STRINGS

'---------------------------------------

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

 

'---------------------------------------

' BOOLEAN

 '---------------------------------------

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

 

 

Remember to lock the database before adding your field

'---------------------------------------

' LOCK the Database

'---------------------------------------

CommonPlugin.ACTFM.Database.LockDatabase(Act.Framework.DatabaseLockReason.SchemaChanges)

 

'---------------------------------------

' Save the field changes

'---------------------------------------

CommonPlugin.ACTFM.Fields.Save(Me.FieldDescriptor)

 

'---------------------------------------

' Unlock the database

'---------------------------------------

CommonPlugin.ACTFM.Database.UnlockDatabase()

 

Hope this helps 

-- Jim Durkin

Avid Listener
Posts: 44
Country: USA

Re: field.attribute(field.property(defaultvalue) = how to set

Thanks Jim, much appreciated
DBS