Jump to content

Change column order based on row values


Recommended Posts

Hello Tibco Community,

In Spotfire I am often working with large data tables containing many columns. I would like to change the order of certain columns, based on the values of a certain row. Basically what I am trying to achieve is very much similar to "sort left to right" in Excel. Sometimes the row values used to sort the columns are numeric, other times they are strings.

Since my tables contain many columns, and I want to sort based on the values on different rows, manually dragging them is not a feasible option.

I searched through the documentation and forum posts but could not find a way to automate this.

Anyone has an idea how to do this in Spotfire (e.g. in IronPython)

Many thanks in advance for your help!

 

Example table (before sorting columns):

 

 

 

Row

Some metadata

Sample 1

Sample 2

Sample 3

Sample 4

Sample 5

 

 

 

 

1

Blue

1

1

0

1

2

 

 

2

Yellow

2

0

1

2

1

 

 

3

Orange

1

0

0

2

1

 

 

4

Green

1

2

2

0

0

 

 

5

Black

0

1

0

1

1

 

 

 

Example table (after sorting the "sample" columns based on their values in row 3):

 

 

 

Row

Some metadata

Sample 2

Sample 3

Sample 1

Sample 5

Sample 4

 

 

 

 

1

Blue

1

0

1

2

1

 

 

2

Yellow

0

1

2

1

2

 

 

3

Orange

0

0

1

1

2

 

 

4

Green

2

2

1

0

0

 

 

5

Black

1

0

0

1

1

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...