Community
Showing results for 
Search instead for 
Do you mean 
Reply

Retrieving History Field Descriptor

Highlighted
Astute Commentator
Posts: 197
Country: United States

Retrieving History Field Descriptor

This is for Act! 21

 

Trying to retrieve a field descriptor from the history table only to get an error that it does not exist. I'm using the code below:

   fdHistoryDateFieldDescriptor = ACTFM.Histories.GetFieldDescriptor("TBL_HISTORY.STARTTIME")

 

I've also tried START_DATE_TIME and everytime the framework reports that the field does not exist.

Any idea how to get the time displayed by the history item?

 

 

 

T

 

Bronze Super Contributor
Posts: 1,254
Country: USA

Re: Retrieving History Field Descriptor

 

I usually iterate thru all the field descriptor liek this....

 

cFieldDescrip = GetHistoryFieldDescriptorByName(HostFramework, "STARTDATE")

 

   Public Shared Function GetHistoryFieldDescriptorByDisplayName(ByVal HostFramework As Act.Framework.ActFramework, ByVal sDisplayName As String) As Act.Framework.Histories.HistoryFieldDescriptor
        '------------------------------------------------------------
        ' Check all other fields in the GetNoteFieldDescriptors
        ' And return the One where sDisplayName = cField1.DisplayName
        '----------------------------------------------------------------
        For Each cField1 As Act.Framework.Histories.HistoryFieldDescriptor In HostFramework.Histories.GetFieldDescriptors()
            If sDisplayName.ToUpper = cField1.DisplayName.ToUpper Then
                Return cField1
                Exit For
            End If
        Next

        Return Nothing
    End Function

Hope this helps

-- Jim Durkin

Astute Commentator
Posts: 197
Country: United States

Re: Retrieving History Field Descriptor

Thank you Jim. That is a great way to get the names of the descriptors. In the past, we had to put TBL_HISTORY. in front in order to get the descriptor. However, when retrieving the history descriptors, supplying the field name only seems to do the trick.

 

Have a good weekend.

 

T