I’m just not really good at coding…
learned only to fork on Replit and I could find my way around changing 1 little think n the code
You can fork it and do whatever you like with it
But if all you want is an ascending sort, you can just override the default by typing asc in that box
but then the sorted list is not correct
You’d have the same problem if you changed the default. I think you need an if-then-else column
how do I determine which joind list to show if the sort column is in several rows/ how do I check it exists in some\all of them?
I forgot to mention that I only display this row in a specific viewed group.
Its a bit hard for me to explain. but I dont use the hole table for the list.
only in the group the user currently views.
Okay, let me try to paraphrase just to confirm my understanding:
- The table contains rows for all users
- Each user may or may not have entries in the Sort column
- For each user, if any of that users rows have an empty value in the Sort column, then the table should not be sorted for that user
Is that correct?
1 and 2 ok
3 - It should be sorted but like the glide logic for sorting the list because i display the sorted inline list right under and the logic is:
If all rows have no sort then its sheet order asc.
If some rows have sort then its blank sort top and the sort by asc under them.
If all rows have sort then its regular asc by sort
I was actually able to fork and find where to change the default order. hw do I get the link for the code in Github?
This dosnt work : GitHub - Linalt111/glide-jl-sort-by-keys-advanced
You have to publish it as Github Page - but I don’t think that’s actually going to solve your problem?
Is that complicated?
1
That won’t work, because if it just returns the data it will still contain the delimiters, which will break your HTML table.
What you could do is pass it a joined list with no delimiters if you don’t want it sorted, then you’ll be back to where you started. But that would be a bit silly. But I think you’re going down a bit of a rabbit hole here. Rather than trying to mess around with the code, I think this could be handled better in Glide, and only call the code column if it’s actually needed.
Let’s go back to this:
Firstly, I’ll assume that you have a multi-relation from your users table to this table. Given that, I’d do something like this:
- From your Users table, create a joined list through that relation using the values from the Sort column, with no separator.
- Then add an if-then-else column in your users table: If the above joined list column is not empty, then true. This will tell you whether or not the table should be sorted for each user.
- Next, add an if-then-else column in this table (the one that contains all the data): If sort is empty, then 0
- Use the above column to create the joined list of sort keys (the zeros in place of the empty values will ensure they get sorted correctly)
- Now create two template columns for the table rows - one with a separator, and one without.
- Use the experimental code column as it is, passing the joined list of table rows with the separator as the first parameter, and the joined list that uses the if-then-else column (with the zeroes) as the sort keys parameter.
- Finally, one last if-then-else column to decide which joined list to use in your table: if the if-then-else column in your Users table is true, use the sorted one, otherwise use the unsorted one.
Thats really good.
what about the half sorted lists? do I user the delimiter or not?
Actually, just thinking about it a bit more, a better way to do this step would be to use a rollup column, taking the sum of the Sort column. If that sum is greater than zero, then it needs to be sorted.
Which step are you referring to here?
I think the answer is yes. Anything you send to the code column needs the delimiters. The reason for replacing the blanks with zeros is to ensure you have the correct number of sort keys. Otherwise it may not sort correctly.
When sending a 0 delimited sort list it sorts it desc - reversed from the sheet order.
that was my issue all along :).
Yes, but you override that by specifying asc as the sort direction.
That won’t affect it for the ones that don’t need sorting, as they will use the unsorted joined list.
This is not happening - still desc whenever there is no 1>2 the sort is reversed from the sheet order even if the sort is defined asc
Somethings wrong - can you show me?
I need to see the values that get passed as each joined list, and the configuration on the code column.
I am duplicating this app can I add you to the team?