kevv

Slow event frame attributes loop

Discussion created by kevv on Oct 2, 2012
Latest reply on Oct 3, 2012 by spilon

Hi,

 

My query is slow to loop through Event Frames attributes and I would like to improve it. I am looking for a faster way to loop through every Event Frames' attributes. I have 40 static attributes and parsing through ~4000 EF's takes around 2 minutes.

 

 

 
Dim collection = AFEventFrame.FindEventFrames( _ 
dal.Database, Nothing, AFSearchMode.Overlapped, afStartTime, afEndTime, _ 
 "*", "*", Nothing, Nothing, Nothing, True, AFSortField.StartTime, _ 
AFSortOrder.Ascending, 0, maxEvents)


       For Each ef As AFEventFrame In collection
            Dim starTime As String = ef.StartTime
            Dim endTime As String = ef.EndTime
            Dim description As String = ef.Description
            Dim templateName As String = ef.Template.Name
            Dim dict As New Dictionary(Of String, String)

            Dim attributeList As New AFAttributeList(ef.Attributes)
            

            For Each att As AFAttribute In attributeList
                Dim attributeName As String = att.Name.ToString
                Dim attributeValue As String = String.Empty


                Try
                    attributeValue = SecurityElement.Escape(att.GetValue.Value.ToString).Replace(" ", "_")
                Catch ex As Exception
                    Debug.Print("error...")
                End Try

                dict.Add(attributeName, attributeValue)

            Next

        Next

Outcomes