Is there another way to display the filtered data?
I want to display the data according to the SHOW in HOME, but I can't sort it by the number of repetitions in descending order. Is there a way to use Functions to display it?
22 replies
-
What you are showing is the grouping function of the column. There is no way to tell Ninox to order the group number in the table view.
I would recommend that you use a dashboard and view elements or build HTML tables that can organize the data that you want.
-
said:
I want to know how to do it.If you want to use a view element then you have two choices to make:
1) a create a new table of unique data from copy.name then you can add a formula field in this new table that will count the number of records in copy that match then you can link your view element to this new table and there you go.
2) if you don't want to create a new table then you:
a) have to create an array of the unique values from name
b) then do a for loop that finds the first or last record of each value in the new array
c) then you can create new formula field in the view element that then counts the number of records that match the name value.
You can pick one that you think works best for you. Or if you want to expand your skills you can do both.
You have a tried doing html already, so this new way is to create a JSON table that you will use to build your html table.
Try this in a new formula field in the Home table:
let aa := this; let getCopy := (select copy where 'Y&N' = aa.'Y&N'); let uniqueNameArray := unique(getCopy.name); let newData := for loop1 in uniqueNameArray do { category: loop1, count: count(getCopy[name = loop1]) } end; newData order by -number(count)
You will see a new "table" showing you data in an arrangement that is close to what you want. Now you can use this JSON to build your html tables.
-
said:
I feel like I'm close to succeeding, but how can I use this JSON to build my HTML tables?You can try this:
let aa := this; let getCopy := (select copy where 'Y&N' = aa.'Y&N'); let uniqueNameArray := unique(getCopy.name); let newData := for loop1 in uniqueNameArray do { category: loop1, count: count(getCopy[name = loop1]) } end; "-------------------------------------------------------------------------"; let css := " <style> table{ width:100%; background-color:rgb(255,255,255) } .tableFixHead { overflow-y: auto; height: 100%; } th { padding: .2em .5em; background-color: rgb(65,105,251); color:white; } ttt { padding: .2em .2em; color: rgb(65,105,251); font-size: 1em; font-weight: bold; } td{ font-size:small; padding: .1em .5em; border-radius:.1em; } thead,tfoot{ position: sticky; font-size:small; } thead { top: -.3em; text-align:center; } tr{background-color:rgb(255,255,255);} tfoot{bottom: -.3em;} tr:nth-child(odd){background-color: rgb(250,250,250);} td:nth-child(n+3){text-align:right;} tr:hover{background-color:rgb(240,240,240);} </style>"; let thead := --- <thead> <tr> <th style="white-space: nowrap;"> category </th> <th style="white-space: nowrap;"> count </th> </tr> </thead> ---; let tbody := "<tbody>" + (newData order by -number(count)).(" <tr> <td style=""text-align:center; font-weight: bold; font-size: 0.9em; line-height: 1.2;""> " + category + " </td> <td style=""text-align: left; white-space: nowrap;""> " + count + " </td> </tr> </tbody>"); html(" " + css + "<table> " + thead + tbody + " </table>")
Review the changes to lines 59 - 70. It can be confusing to keep track of breaking in/out of Ninox code.
-
For the normal table view, you can use a sorting column with my rather confusing, ugly code for grouping.
-
Mistake
-
-
Hey :)
Take a look here: https://www.arc-rider.de/documentation/customsort-einbinden
We have developed widgets for ninox. Among other things, a sorting widget that you can integrate into a custom table. This way you can easily sort the view.
If you have any questions about this, please feel free to get in touch :)
Content aside
- Status Answered
- 4 mths agoLast active
- 22Replies
- 130Views
-
4
Following