logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
CPBOURG  
#1 Posted : Monday, September 17, 2018 8:15:14 AM(UTC)
CPBOURG

Rank: Advanced Member

Groups: Registered
Joined: 9/13/2018(UTC)
Posts: 41
Belgium
Location: Ottignies

Was thanked: 2 time(s) in 2 post(s)
Hello,

I would like first to congratulate the team for SealReport, this product is amazing!

Once I get a clearer view over the product, I would be glad to contribute, for instance, I noticed that there is no object model published? that would help a lot when using scripts! Any input welcome. Or maybe a tooltip help, or an autocomplete (I will add these suggestions in the appropriate category).

For now, I have a specific question, I am trying to sort descending on the automatic Total column of my data table, but couldn't find an automatic way of doing it. Have I missing something, or is there a way using scripting to achieve this?

Thanks !
Thomas
epf  
#2 Posted : Monday, September 17, 2018 9:36:54 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
Thank you for your feedback,
If you want to contribute, please contact Ariacom at www.ariacom.com and we will have direct contact by email.

Concerning the sort of the Total column, this option is not available...
However you could for the sort of your final data table like this:
Select your 'Data Table' view, then edit the 'Custom template' property to modify the line
Code:
order: [[ 9, "desc" ]],

Where 9 is the column you want to be sorted (9 = column number 10 !)

I will add a parameter in the 4.1 to control this...

In attachment is my sample.
Test sort total.srex (14kb) downloaded 2 time(s).
CPBOURG  
#3 Posted : Monday, September 17, 2018 11:03:49 AM(UTC)
CPBOURG

Rank: Advanced Member

Groups: Registered
Joined: 9/13/2018(UTC)
Posts: 41
Belgium
Location: Ottignies

Was thanked: 2 time(s) in 2 post(s)
Thanks for the prompt reply!

I could get it working using the number of the last column as you mentionned : thanks !

I tried first to use order: [[ table.ColumnCount-1, "desc" ]], in order to always use the last column number, whatever the number of columns (as it can change in a CrossTab with drilldowns), but that doesn't work. the result table is then empty...

Thanks again
Thomas

epf  
#4 Posted : Monday, September 17, 2018 11:40:55 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
To make it dynamic, you have to set:
Code:
order: [[ @(table.ColumnCount -1), "desc" ]],


You are in JavaScript but user @ for Razor parsing first...
CPBOURG  
#5 Posted : Monday, September 17, 2018 12:12:05 PM(UTC)
CPBOURG

Rank: Advanced Member

Groups: Registered
Joined: 9/13/2018(UTC)
Posts: 41
Belgium
Location: Ottignies

Was thanked: 2 time(s) in 2 post(s)
Brilliant!

Many thanks.
Thomas
CPBOURG  
#6 Posted : Tuesday, November 20, 2018 10:25:42 AM(UTC)
CPBOURG

Rank: Advanced Member

Groups: Registered
Joined: 9/13/2018(UTC)
Posts: 41
Belgium
Location: Ottignies

Was thanked: 2 time(s) in 2 post(s)
Hi,

I just tried to apply the same sort on the last column using the new parameter 'Data tables: Sort configuration', but I am not sure what to use there as syntax...

Will it work the same way as [ @(table.ColumnCount -1), 'desc' ] ?

That one doesn't seem to work...

Thanks for your help
Thomas
epf  
#7 Posted : Tuesday, November 20, 2018 10:36:23 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
For this you have to specify the index of the column...

This cannot be dynamic as the razor script is already compiled.
[0,'asc'] indicates to sort the first column.

So this can be used if your number of columns is known...otherwise use the previous method...

Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.