Sorting Datatable in C++ for Blueprints?

I’m a bit of a beginner so I can’t say if it’s fastest way (I don’t think you can sort datatables). But I would create a new struct with the row name and the value you want to sort by. Then create an TArray of that struct.

USTRUCT() struct FMySortingStruct {
	GENERATED_BODY()
	FName RowName;
	float MyFloatValues;
};

TArray<FMySortingStruct> MySortingArray

Populate the array with the findrow command. Use a sorting algorithm on said MySortingArray. Lastly output the RowNames from the TArray to your Blueprint.
(but maybe my brain is dum-dum)

1 Like