Yes, to sort, interpolate, then sort back, this will do the job:
Dim temp_length: temp_length = Data.Root.ChannelGroups(1).Channels("AveragedTemp").Properties("length").Value
Call ChnLinGen("/LinearGenerated", 1, temp_length, temp_length, "")
Call ChnMultipleSortExt("[1]/AveragedTemp", "[1]/LinearGenerated", "Up", "UpperCase", True)
Call ChnMapLinCalc("[1]/Temp", "[1]/Capacity", "[1]/AveragedTemp", "[1]/TempCapacity", True, "const. value", NOVALUE, "analogue", 0)
Call ChnMultipleSortExt("[1]/LinearGenerated", "[1]/AveragedTemp", "Up", "UpperCase", True)
Call Data.Root.ChannelGroups(1).Channels.Remove("LinearGenerated")