You can use the following variables:
Variable
Comment
%ASC%
Contains Keywords "ASC" or "DESC" depending on sort order
%ISASC%
TRUE if Index column sort is ascending