10-18-2011 09:21 AM
I am collecting Field info the Contacts database and inserting the info into an ACCESS database, using the following code:
Dim cFieldDetails As Act.Framework.Database.FieldDescriptorCollection = HostApplication.ActFramework.Fields.GetFields(Act.Framework.RecordType.Contact)
For Each field As Act.Framework.Database.FieldDescriptor In cFieldDetails
str = "INSERT INTO ContactFieldsStructure (FieldName,FieldType, FieldSize) VALUES ('" & field.Name & "','" & field.FieldDataType.ToString () & "','" & field.GetSize() & "');"
cmd = New OleDbCommand(str, cn)
icount = cmd.ExecuteNonQuery
What I am finding is that the GetSize() call does return Field sizes where applicable, but seems to have an error for any Fields that are related to addresses. For each of those fields, the ActDiag program will give me a field size of "256", but the GetSize() call will return "0" for the Field size.
Should I assume a Field size of 256 bytes for all address fields, including State and Zip Code fields?
10-18-2011 09:20 PM
You may want to look at the ACT_COLUMNS table in the SQL database. You can access it from the ACTOLEDB.2 reader.
SELECT ACTDATATYPE, DECIMALPRECISION, DESCRIPTION, DISPLAYNAME, FUNCTIONCOLUMN, IS_CONVERT_UTC2LOCAL_TIME, IS_DERIVED, ISVIEWCOLUMN, LENGTH,
PHYDATATYPE, PHYSICAL_COLUMN, PROVIDER_VIEWNAME, VIEWNAME
You could also read the Length attribute frm the field descriptor.
If Me.FieldDescriptor.Attributes.Contains(Act.Framework.Database.FieldProperty.Length) Then
Dim LengthAttribute As Act.Framework.Database.LenogthAttribute = Me.FieldDescriptor.Attributes.Item(Act.Framework.Database.FieldProperty.Length)
Hope this helps
-- Jim Durkin