Sometimes you may face a necessity to change sorting expression of a DataBand. Unfortunately there is no way to change this expression from scripts code because by the moment of scripts running, the sorting expression (that is also a script) is already compiled for calculations.
But to change it, you can use the following workaround:
1. Read a template from a slot before report formatting
2. Change the sorting expression in the template
3. Save it back to the slot and render a document
var document = inlineReportSlot.LoadReport();
var dataBand = document.Pages.ControlByName("dataBand1") as DataBand;
dataBand.Sort.Expression = newExpression;