Community
Showing results for 
Search instead for 
Do you mean 
Reply

Problem Getting Address Field Lengths in Contact table

Copper Super Contributor
Posts: 88
Country: USA

Problem Getting Address Field Lengths in Contact table

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
Next

 

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?

Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Problem Getting Address Field Lengths in Contact table

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
FROM MyDatabase.dbo.ACT_COLUMNS

 

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)

End if

 

Hope this helps

 

-- Jim Durkin