Hi what is the proper way to sort a list on a specified property name called “count”? Thank you for your help.
Hi @William_Lee !
Unfortunatelly you can’t do it using standard Codeless “sort” block. I have created an internal ticket BKNDLSS-24747 to inctoduce new block which will allow to perform this kind of sorting.
Sorry for inconvenience.
Regards, Andriy
Can you please provide an example of how this sort block currently works if it doesn’t currently work with the GET PROPERTY block? Thanks!
I wasn’t quite sure why the standard Codeless “sort” block wasn’t working so I did some experiments to see if I could do a work around… But as you can see from my attempts below… I know now what you mean about the List Sort block not working with Table Objects in a List.
The following attempts worked with simple lists…
!However when I load a table into a list the List Sort Block doesn’t work. You’ll see that the state abbreviation names aren’t being sorted at all.
Another attempt by moving the sort block into a different position but it still doesn’t sort the State abbreviations output.
And these final attempts below just don’t return any message box at all.
Hopefully this will be helpful for anyone working on a new type of custom block or even a workaround that can handle sorting a database table loaded into a List Variable.
Any ETA on when this new sort block can be ready? Thanks!
Hello @William_Lee
For sorting data from a table, you can use a “sort” property in the Load Table Objects block with SQL syntax.
At this moment, the sort block works with a list what have only primitives values like a string or number, but your issue makes sense. And ticket what been created earlier will be released soon(now in testing). We notify you when it will be implemented.
What about your attempt to sort.
The first three tries with objects, don’t work because is not primitives. And last - you try to sort a string value in the loop with the length of your var list. Like
['a','b','c']
sort('a')
sort('b')
sort('c')
Regards, Dima
Thank you Dima… Yes I was already pulling table data from the database with a sort option on the page load and was hoping to just put that data into a list and then do the sorts without having to request the data again from the database.
I’m looking forward to your new sort block when it comes out. Thanks to you and the Backendless team for being so responsive and working on these new blocks… Codeless blocks have really opened up new possibilities for me. Regards! William
Hi, @William_Lee
We added the feature you wrote about above. A new list sorting block. You can find it in the Lists category. Could you let us know if this block works well for you?
Regards,
Marina
Hi Marina, unfortunately I wasn’t able to get it working in my page “pg_category_search” for “Row1” where I’m trying to load an unsorted table called “smCategoryCount”.
Here’s the sequence.
“pg_category_search” on_page_enter
(I’ve disabled the sort option for the Load Table block)
Here’s your new list sort blocks I’m trying to use the “Row1” Dynamic Items Logic section but it’s not working.
The data loads correctly on “Row1” but it’s not sorting the list as you can see from page screenshot.
My App ID is 721AC780-A565-8D74-FF75-5158A2EB5500
Did I mess up something? Thanks!