[Human Readable Change History] GetFirstTextAttribute returning the last text attribute
Question
Forge component by Johan den Ouden
Application Type
Traditional Web, Reactive

Hi,

When looking for the text attribute of the entity in the SQL GetFirstTextAttribute, it returns a list of text attributes. Following which, we assign the output as GetFirstTextAttribute.List.Current.Query_EntityAttr.Name. As a result, this returns the last record of the list (instead of the first which we need). Therefore, I propose to include TOP 1 in the SQL. 

SELECT TOP 1 {Entity_Attr}.[Name],{Entity_Attr}.[Type] 
FROM  {Entity_Attr}
WHERE {Entity_Attr}.[Entity_Id] = @EntityId 
AND {Entity_Attr}.[Is_Active] = 1
AND {Entity_Attr}.[Name] not in (@PossibleNamesList )
AND {Entity_Attr}.[Type] = 'rtText'
ORDER BY {Entity_Attr}.[Order_Num] ASC
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.