Jump to content

Is there any way I can use iron-python to customize the sort order of an imported column (e.g. prompt the custom sort order settings with a button in the text area) so that web users can access easily?


Kom Son
Go to solution Solved by Jose Leviaguirre,

Recommended Posts

Hello,

I'm not aware of any way you could reuse/prompt the display of the existing Spotfire dialogs for defining the sort order in this way - I believe you will need to handle that part yourself - but once you have the sort order defined in some way, the following article should give you some ideas on how to apply it:

https://community.spotfire.com/s/article/IronPython-script-to-Set-Custom-Sort-Order

 

Link to comment
Share on other sites

  • 3 weeks later...
  • Solution

Here is an implementation of your requirement:

custom_order.gif.821805c9410db7124849b1f4e71d20db.gif 

  1. On a Text Area, Create a List box (multiple select) Property Control with Unique values in column pointing to a new String List Document Property called "values"lb_dp.png.1f00162ddd15c609969f15d73e71db5d.png
  2. Create a Label Property Control on a Text Area using the "values" document property to output the selecting order of the columns and add a "Apply" Action Control Buttonta.png.57050fc9df5795cf6ef64f7a8af36790.png
  3. Create an IronPython script for the Apply button :
tblName = "Blood Work"colName = "type"values = Document.Properties["values"]dt = Document.Data.Tables[tblName]# The values in values must be of the same type as the values in the column. # Column values not present in values will be sorted last. dt.Columns[colName].Properties.SetCustomSortOrder(values)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...