Sorting for a View Element
I have a relation field with multiple records in it and I display it via a view element. Now I want to have some dynamic sorting by name, or by a number, but with the sorting I dont have some luck. Here is the code without the sorting and prepared for it.
let ActiveRecords := (select 'Line-up' where Zeitaufzeichnung.'Aufzeichnungen Meldung' like "recordings");
let ActiveRecordsbyName := ActiveRecords.Name;
let ActiveRecordsbyAmount := ActiveRecords.'Erarbeiteter Wert';
let AZ := ActiveRecords;
let ZA := ActiveRecords;
let Amount_UP := ActiveRecords;
let Amount_DOWN := ActiveRecords;
let WorkingInIt := ActiveRecords;
switch 'Sortierung Produktion' do
case 1:
AZ
case 2:
ZA
case 3:
Amount_UP
case 4:
Amount_DOWN
default:
WorkingInIt
end
19 replies
-
Hi
I am fairly certain that the sort order is defined in the view (where you say which columns to show and you are able to sort one of them ascending or descending, not in the script that creates it.
Regards John
-
If it were me, I'd go with creating 4 views. You have done so much prep work anyway.
-
Of course, good luck!
-
Jacques has some good tips on ordering.
So you could do something like:
let ActiveRecords := (select 'Line-up' where Zeitaufzeichnung.'Aufzeichnungen Meldung' like "recordings"); switch 'Sortierung Produktion' do case 1: ActiveRecords order by upper(Name) case 2: you will have to decide if you want to implement the global function case 3: ActiveRecords order by 'Erarbeiteter Wert' case 4: ActiveRecords order by -'Erarbeiteter Wert' default: ActiveRecords end -
On the other hand, you could still use Fred's method if you replace the view with an HTML table in a formula field. Which is in my opinion much nicer than a regular view element...
-
I included an example database based on the Contacts template. If you look in the dashboard, you'll see the html-table.
I also find it strange I cannot sort using the switch function so I had to use the if then loop... (see attachment) maybe you have any ideas?
A click on the Contacts picture opens the record

-
check out great Dashboard Template for what you can do with HTML and Ninox.
Content aside
- 1 hr agoLast active
- 19Replies
- 44Views
-
5
Following
