Community
Showing results for 
Search instead for 
Do you mean 
Reply

Get history types

New Member
Posts: 14
Country: United_Kingdom

Get history types

Hi, I am trying to get a list of history types and couldnt figure out how I would do this with the sdk so I decided to use oledb. But I am now recieving the following error:

 

System.Data.OleDb.OleDbException: Invalid table name.
Dictionary::AddTableNode failed (error=80004005).
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteReader()
at ACT_Sample.frmMain.Button8_Click(Object sender, EventArgs e) in C:\Documents and Settings\Bryan\Desktop\Jamie\Act\ACT_Sample\WindowsApplication2\frmMain.vb:line 297

 

        actCon.ConnectionString = oActFwk.CurrentACTOLEDB2
        SQL = "SELECT [HISTORYTYPEID] ,[NAME] ,[DESCRIPTION] ,[HISTORYTYPEGROUPID] FROM HISTORYTYPE"

        Try
            actCon.Open()
            cmd = New OleDbCommand(SQL, actCon)
            reader = cmd.ExecuteReader()
            While reader.Read()
                MsgBox(reader.Item(0) & "  -  " & reader.Item(1))
            End While
            reader.Close()
            cmd.Dispose()
            actCon.Close()
        Catch ex As Exception
            MsgBox("Failed!:" & vbNewLine & ex.ToString)
            TextBox1.Text = ex.ToString
        End Try
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Get history types

I think you may have got the table name incorrect from the rror msg.

 

To get the History types via sdk:

 

//oFram == instance of ActFramework. 

HistoryType[] arrayOfHistTypes = oFram.Histories.GetHistoryTypes();

foreach(HistoryType hT in arrayOfHistTypes)
{
   MessageBox.Show(hT.Name + " Desc: "+hT.Description);
}

 HTH

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
New Member
Posts: 14
Country: United_Kingdom

Re: Get history types

Thanks, I now have a list of history types. But do you have any idea why id is returned as 0 and name returned as "" for both group and supergroup?
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Get history types

hmmm not sure. do you get the same result if you run your code on the demo dB?

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
New Member
Posts: 14
Country: United_Kingdom

Re: Get history types

I tried it with the demo company with the same result. I dont think theres anything wrong with the code the groups appear in intellisense.

        Dim arrayOfHistTypes As HistoryType() = oActFwk.Histories.GetHistoryTypes()

        For Each hT As HistoryType In arrayOfHistTypes
            MessageBox.Show(hT.HistoryTypeId.ToString + " " + hT.Name + " Desc: " + hT.Description + vbNewLine + "group: " + hT.HistoryTypeGroupId.ToString + hT.HistoryTypeGroupName + vbNewLine + "supergroup: " + hT.HistoryTypeSuperGroupId.ToString + hT.HistoryTypeSuperGroupName)
        Next

 



Employee
Posts: 1,163
Country: USA

Re: Get history types

[ Edited ]

I just debugged through my project and all of my HistoryTypes had both an ID and a name including the custom types. I did however do this through plugin and not the framework, I'll try to get around to testing this to confirm if that's the problem.

 

Are all of these properties coming up empty or 0 or just the HistoryTypeId and Name?

Matthew Wood
Act! SDK Support
Community Moderator
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Get history types

I just tried a test app and your right!

 

Unfortunately I have absoloutly no idea what these properties are for and they are new to the 13.x framework! Initially I thought that they might associated with custom history types but that is not the case. Hopefully someone from Sage might be able to enlighten us both!

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
New Member
Posts: 14
Country: United_Kingdom

Re: Get history types

hT.HistoryTypeId, hT.Name and hT.Description have values

 

hT.HistoryTypeGroupId, hT.HistoryTypeGroupName,  hT.HistoryTypeSuperGroupId and hT.HistoryTypeSuperGroupName are empty

Silver Super Contributor
Posts: 2,328
Country: USA

Re: Get history types

Vivek is correct.  The table name is "TBL_HISTORYTYPE".

 

Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!