Community
Showing results for 
Search instead for 
Do you mean 
Reply

Create Field

Tuned Listener
Posts: 44
Country: Canada

Create Field

Hey I was going through the SDK and cannot find it. I want to create a field if it does not exist in the database via Visual Basic code. Anyone know how to do that.


Matt

Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Create Field

Sorry I've competely forgotten VB syntax so here's it in C# pseudo-code:

 

Act.Framework.Database.FieldDescriptor myField = new Act.Framework.Database.FieldDescriptor(stringFieldName, RecordType, FieldDataType);

 

//apply field properties code...

 

Act.Framework.ActFramework oFram.Fields.Save(myField);

 

HTH

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
Nickel Super Contributor
Posts: 352
Country: Canada

Re: Create Field

Vivek,

 

Thanks for sharing this!

 

Have you got any code you can share that gets a list of the fields / attributes that exist?

 

Thanks,

Len

Len Kamerman
ACT! Certified Consultant

Act E-mail Marketing Trainining Course:

http://actsoftware.training
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Create Field

Hi Len,

 

Getting the FieldDescriptors collection should be fairly straight forward (via the Act.Framework.Database) you can then itterate through each FieldDexcriptor to get it's FieldDescriptorAttributeCollection. You can then itterate through that collection to list out each FieldProperty.

 

There maybe some syntactic errors above since I am doing that from memory, what I do remember though is that it is really tedious code.

 

HTH

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
Nickel Super Contributor
Posts: 352
Country: Canada

Re: Create Field

Thanks Vivek!

 

I'll check it out - I poked around before and it didn't seem that obvious, but I think as long as I find the FieldDescriptors collection I should be able to work my way through it.

 

Thanks!

Len.

Len Kamerman
ACT! Certified Consultant

Act E-mail Marketing Trainining Course:

http://actsoftware.training