AnsweredAssumed Answered

ft_InterpolateRange Index was out of range

Question asked by mfarrow on Feb 13, 2017
Latest reply on Feb 27, 2017 by mfarrow

Hi,

 

Perhaps I'm just new to this, but I have been trying to use the ft_Interpolate range table and have been receiving the "Index was out of range. Must be non-negative and less than the size of the collection.  Parameter name: index" error message.

 

I have an unusual arrangement to work with in our AF structure.  The query starts with sub-events, which must be joined to the parent event, then joined to the parent reference element, then compared to another element with the desired attributes.  This is all because the sub-events do not reference the correct element for my query, see below.

 

SELECT

ef2.name EFName,

ef.name SubEFName,

ef.StartTime,

ef.EndTime,

e.Name Element,

ea.Name Attribute,

i.Time,

i.Value,

i.ValueDbl,

i.ValueStr,

i.IsGood

FROM [LSM_SSM_PRIMARY].[EventFrame].[EventFrame] ef

INNER JOIN [LSM_SSM_PRIMARY].[EventFrame].[EventFrame] ef2 on ef2.ID = ef.PrimaryParentID

INNER JOIN [LSM_SSM_PRIMARY].[EventFrame].[EventFrameTemplate] eft on eft.ID = ef2.EventFrameTemplateID

INNER JOIN [LSM_SSM_PRIMARY].[EventFrame].[EventFrameReferencedElement] efre on efre.EventFrameID = ef.ID

INNER JOIN [LSM_SSM_PRIMARY].[Asset].[ElementHierarchy] eh on eh.ElementID = efre.ElementID

INNER JOIN [LSM_SSM_PRIMARY].[Asset].[Element] e ON e.Name = eh.Name + ' Chrome Skid'        --ugly join because events not created under correct reference element

INNER JOIN [LSM_SSM_PRIMARY].[Asset].[ElementAttribute] ea ON ea.ElementID = e.ID,

[LSM_SSM_PRIMARY].[Data].[ft_InterpolateRange] i

WHERE

AND i.ElementAttributeID = ea.ID -- first InterpolateRange TVF argument

AND i.StartTime = ef.StartTime -- second InterpolateRange TVF argument

AND i.EndTime = ef.EndTime -- third InterpolateRange TVF argument

AND i.TimeStep = N'1h' -- fourth InterpolateRange TVF argument

OPTION (FORCE ORDER, EMBED ERRORS)

Outcomes