Community
Showing results for 
Search instead for 
Do you mean 
Reply

change the customised field name in the database?

Accepted Solution Solved
Copper Contributor
Posts: 27
Country: Israel
Accepted Solution

change the customised field name in the database?

I created a field called "VehicleName"

and added the field to contacts.

 

The field name that was added at the Database is :"CUST_VehicleName_061246071"

which makes queriing very difficult,

 

1. Can i see the field name in the database by using ACT! interface? (not getting inside the database and guessing which field is who)

2.how can i change the name of the field in the database to a simplier one ?

i believe that if i change the field name manually in the database, ACT! will "loose" it , looking for the old name , so there must be a way to change the name manually from the ACT! interface....

i tried the "Define Fields.." option but i dont see the database field name there...

 

 


Accepted Solutions
Solution
Accepted by topic author rodnikosh
‎09-25-2015 03:20 AM
Bronze Super Contributor
Posts: 1,231
Country: USA

Re: change the customised field name in the database?

[ Edited ]

You want to use the ACTOLEDB2.dll. It publishes the display names rather then the SQL column names. The OLE/DB Views in ACTOLEDB2.dll are constructed using the Table Displayname and the Column Displayname.

 

Here is an example function to get a dataset passing the ACTFramework and the SelectCommand:

  

   Public Shared Function GetDataSet(ByVal HostFramework As Act.Framework.ActFramework, ByVal sSelectCommand As String) As DataSet
        Dim ds As New DataSet()
        Dim selectCMD As OleDb.OleDbCommand = New OleDb.OleDbCommand(sSelectCommand, New OleDb.OleDbConnection(HostFramework.CurrentACTOLEDB2))
        Using dataAdapter As New OleDb.OleDbDataAdapter(selectCMD)
            dataAdapter.Fill(ds, "EntityItems")
            Return ds
        End Using
    End Function

 

Call the GteDataSet function like so:

 

GetDataSet(

Me.ACTFramework, "Select VehicleName from Vehicle where brand = 2 and color = 'red'")

 

This older thread may help in understanding the OLE v2 naming conventions. Look for the posts from Bill. Ignore the code with "VRP_" it was using the older OLEDB version 1 that shipped with ACT 2009 or older.

http://community.act.com/t5/Sage-ACT-Developer-s-Forum/Overflow-Table-Naming-convention/m-p/25198/hi...

  

Hope this helps

-- Jim Durkin

 

 

View solution in original post


All Replies
Bronze Super Contributor
Posts: 1,231
Country: USA

Re: change the customised field name in the database?

1. Yes the field descriptor has a property called .ColumnName which is the field in the DB.

 

2. You never want to change ANYTHING in the ACT DB directly.
It usually breaks the database and always breaks the End-user License Agreement. (EULA)

 

Look at the thread. Matt Wood posted some code to retrieve the field descriptor using you new field name.

 

http://community.act.com/t5/Sage-ACT-Developer-s-Forum/Newbie-trying-to-update-a-Contact-field/m-p/8...

 

-- Jim Durkin

Copper Contributor
Posts: 27
Country: Israel

Re: change the customised field name in the database?

thanks , that helps alot ,

but can't i see the database field name using the ACT! interface? (not code?) 

like in the field properties or "Define fields.." or other options?

Bronze Super Contributor
Posts: 1,231
Country: USA

Re: change the customised field name in the database?

I do not know of any UI element that expoes the actual SQL column name.

 

Why would you need to show it?

 

-- Jim Durkin

 

Copper Contributor
Posts: 27
Country: Israel

Re: change the customised field name in the database?

i don't really need to show it to the user,

i just want an easy control over the field in the DB:

 

1. so i won't need to guess which field in the form is which one in the DB table.

2. change its name to a logical one instead of serie of numbers, so when i write queries in the DB (SQL server management studio) i won't need to write the query with wierd names like :

 

Select CUST_VehicleName_061246071

from table

where  CUST_brand_3234239 = 2 and CUST_color_234234234 = 'red'

 

so there is no way to change the names right ? only retrieve the name using the descriptor ?

Solution
Accepted by topic author rodnikosh
‎09-25-2015 03:20 AM
Bronze Super Contributor
Posts: 1,231
Country: USA

Re: change the customised field name in the database?

[ Edited ]

You want to use the ACTOLEDB2.dll. It publishes the display names rather then the SQL column names. The OLE/DB Views in ACTOLEDB2.dll are constructed using the Table Displayname and the Column Displayname.

 

Here is an example function to get a dataset passing the ACTFramework and the SelectCommand:

  

   Public Shared Function GetDataSet(ByVal HostFramework As Act.Framework.ActFramework, ByVal sSelectCommand As String) As DataSet
        Dim ds As New DataSet()
        Dim selectCMD As OleDb.OleDbCommand = New OleDb.OleDbCommand(sSelectCommand, New OleDb.OleDbConnection(HostFramework.CurrentACTOLEDB2))
        Using dataAdapter As New OleDb.OleDbDataAdapter(selectCMD)
            dataAdapter.Fill(ds, "EntityItems")
            Return ds
        End Using
    End Function

 

Call the GteDataSet function like so:

 

GetDataSet(

Me.ACTFramework, "Select VehicleName from Vehicle where brand = 2 and color = 'red'")

 

This older thread may help in understanding the OLE v2 naming conventions. Look for the posts from Bill. Ignore the code with "VRP_" it was using the older OLEDB version 1 that shipped with ACT 2009 or older.

http://community.act.com/t5/Sage-ACT-Developer-s-Forum/Overflow-Table-Naming-convention/m-p/25198/hi...

  

Hope this helps

-- Jim Durkin