If I understand your question well, and if the sort column is never textual, I believe you could do this as follows:
load the .dset
Calculate new column as below, using the EVAL() function and (if the sort order is DESC) inversing the numeric sign
if {txt_sort_mode} = 'ASC'
then eval('['&{txt_sortcolumnname}&']')
else -eval('['&{txt_sortcolumnname}&']')
sorting on this colum, always ascending (as you have already covered the sort order when calculating the column)
If the sort column can also be textual, then the above won’t work. I would then reduce the computation to the eval() function without the condition on the ASC/DESC; and use the derived table approach that you’re currently using.