Totals of Repeating Group formulated from API

Ok so I’ve successfully answered my own question thanks to @SerPounce Calculating grand totals in repeating group - #7 by SerPounce

But, can anyone help me on how to sort an RG by an input field in the RG (that’s not in the dB)…?