Customer Banners (Ads) - SpiceUp. AX and SpotfireX Disclaimer



Warning when upgrading to Spotfire 10

TIBCO has deprecated the JQueryUI Javascript library in the latest Spotfire 10.0 release

TIBCO Community pages show us how to use JQuery properly

Reverse sort order on filters

Unfortunately there is no way to reverse the sort order on non categorical data such as dates and numbers on columns or filters from the user interface without scripting.

Without scripting (calculated column)

Repeat("0",Max(Len(String(DenseRank([Date],"desc")))) - Len(String(DenseRank([Date],"desc")))) & DenseRank([Date],"desc") & " - " & [Date] as [DDate]





With scripting

def sortDates():

dateOrder=[]
dateVals = dataTable.Columns['Date'].RowValues.GetEnumerator()

for d in dateVals:
                dateOrder.Add(d.ValidValue)
                dateOrder.sort(reverse=True)

dataTable.Columns['Date'].Properties.SetCustomSortOrder(dateOrder)
print dateOrder

sortDates()


3 comments:

Unknown said...

Instead of using the calculated column you can use column sort order itself in column properties

Jose Leviaguirre said...

Thanks for your comment Shaheerkp,

Your thought process is good, however the reverse option only works with string data type (text), so you will have to convert the data type into string and change the date formatting to have the proper sorting.

戴久坤 said...

this is awesome. I don't remember how many times I told others this is impossible except for option 1 (without scripting). Option 2 get this done beautifully. Thank you for sharing.