IronPython script to reset sort order in Cross Table.

I'm hoping someone can help me out here, I'm not terribly proficient in writing IronPython scripts from scratch.

One of the requirements for a project I'm working on is to provide a reset sort order button on a cross table.  The cross table looks something like this:

Account Actuals Budget Variance
Abc Co. 123.00 456.00



We'd like to add an action control which would set Variance (which is an aggregations) in desending order when clicked.  Where I have problems in attempting to write this script is appregation.  I have no idea how to tell Spotfire, in IronPython, I want to sort by Variance.  The expression I'm using to come up with Variance isn't straight forward, there are conditions (see below).  Anyhow, I hope someone can help me out.

Expression to calculate Variance in the Cross Table:
    ,If((String([Variance (Local)])='') OR ([Variance (Local)] IS NULL),0,[Variance (Local)])
    ,If((String([Variance])='') OR ([Variance] IS NULL),0,[Variance]))) as [Variance - YTD]


(2) Answers