Sorting Tables

SOLVE
imerial
Participant

Hi Community,

 

I have a table and I would like to sort it from the highers price to the lowest. 

I know I have to use orderBy= in my query, but I'm not sure exactly how it works. 

Can anyone help? 
Thank you

 

{% set table = hubdb_table_rows(table_id,'assetclass__contains=Future',orderBy='what_goes_here?') %}

table.png

0 Upvotes
1 Accepted solution

Accepted Solutions
amwilie
Solution
Key Advisor | Elite Partner

You would put in the internal name of the column you want to sort by. I beliiieve if you want to go Highest to Lowest it'd be a reverse sort, so add a minus sign in front of the column name. Also, when you have multiple filters in your table function you want to use &, not commas.

 

{% set table = hubdb_table_rows(table_id,'&assetclass__contains=Future&orderBy=-price') %}
border

Alyssa Wilie

Web Developer at LyntonWeb

If this answer solved your question, please mark it as the solution!

View solution in original post

0 Upvotes
1 Reply 1
amwilie
Solution
Key Advisor | Elite Partner

You would put in the internal name of the column you want to sort by. I beliiieve if you want to go Highest to Lowest it'd be a reverse sort, so add a minus sign in front of the column name. Also, when you have multiple filters in your table function you want to use &, not commas.

 

{% set table = hubdb_table_rows(table_id,'&assetclass__contains=Future&orderBy=-price') %}
border

Alyssa Wilie

Web Developer at LyntonWeb

If this answer solved your question, please mark it as the solution!

View solution in original post

0 Upvotes