List. SortType (FieldName As String, Ascending As Boolean)Sorts a list with items of user defined type. The list is sorted based on the specified field.
FieldName - The case-sensitive field name that will be used for sorting. Field must contain numbers or strings.
Ascending - Whether to sort ascending or descending.
Type Person(Name As String, Age As Int)
Sub Activity_Create(FirstTime As Boolean)
Dim Persons As List
For i = 1 To 50
Dim p As Person
p.Name = "Person" & i
p.Age = Rnd(0, 121)
Persons.SortType("Age", True) 'Sort the list based on the Age field.
For i = 0 To Persons.Size - 1
Dim p As Person
p = Persons.Get(i)
B4J Question list sorttype - tufanv    Nov 21, 2017
I have a list like this when i log the list:
As I can see there is a VOLUME24HOUR in the fields but when i use
B4A Question List.SortType() with Localization - Erel (first post)    Feb 5, 2018   (2 reactions)
It is not possible. If all the relevant field values are unique then you can add them to a list and a map where they the key is the field value and the value is the custom type.
Sort the list and then get the types from the map....
B4A Question [solved] using list.sortType with a class instead of a type - Dave O (first post)    Nov 30, 2017   (1 reaction)
Hey @stevel05 , that did the trick, thanks!
FYI, I did find out that if you use sortType, it works fine with numbers. However, if you use sortTypeCaseInsensitive, it treats numbers as strings, so...
B4A Question List.SortType converted to Java ? - vdudukov (first post)    Oct 30, 2017   (1 reaction)
Yes of course, i know that.
I am working with B4A since 2013, and it is my no.1 programm...
B4A Question Use a sorted list with SortType ("filename", False) - Erel (first post)    Apr 12, 2016
This by itself is not an error. Does the program crash? Is there any error in the logs?...
Other B4i v1.21 is released - Erel    Nov 23, 2014   (15 reactions)
B4i v1.21 is now available for download. You can download it with the same links as v1.00. A mail will be sent with the links. This version adds support for designer script and auto scale: http://www.basic4ppc.com/android/forum/threads/designer-script-autoscale-tutorial.47184/ These features make it much simpler to implement flexible layouts. Other improvements: List.SortType / SortTypeCaseInsensitive - Sorts a list made of user defined types. NativeObject.RunMethodWithBlocks, AsBoolean...
B4J Tutorial Parsing huge text files - Erel    Nov 24, 2013   (5 reactions)
.Match, count + 1) In order to sort the data we will add the data to a list and call List.SortType: Dim list1 As List list1.Initialize For i = 0 To ips.Size - 1 Dim ic As IpAndCount ic.Initialize ic.ip = ips.GetKeyAt(i) ic.count = ips.GetValueAt(i) list1.Add(ic) Next list1.SortType....count = ips.GetValueAt(i) list1.Add(ic) Next list1.SortType("count", False) ic... = raf.ReadObject(0) End If raf.Close Dim list1 As List list1.Initialize For i = 0...
Other B4i v7.80 has been released - Erel    Oct 27, 2021   (27 reactions)
I'm happy to release a new version of B4i. Improvements: Support for Xcode 13. Long hex literal numbers: 0xff00ff00ff00 New methods: Bit.OrLong / AndLong / XorLong / ShiftLeftLong / ShiftRightLong / NotLong / UnsignedShiftRightLong / ParseLong List.SortType - stable sort. This means that equal items retain their order. It allows sorting by multiple fields. Fix issue with Unicode sorting and string comparison (https://www.b4x.com/android/forum/threads/b4x-trie-based-search-dialog.134220...
Other B4i v7.80 BETA has been released - Erel    Oct 18, 2021   (21 reactions)
I'm happy to release a new BETA version of B4i. Improvements: Support for Xcode 13. Long hex literal numbers: 0xff00ff00ff00 New methods: Bit.OrLong / AndLong / XorLong / ShiftLeftLong / ShiftRightLong / NotLong / UnsignedShiftRightLong / ParseLong List.SortType - stable sort. This means that equal items retain their order. It allows sorting by multiple fields. Fix issue with Unicode sorting and string comparison (https://www.b4x.com/android/forum/threads/b4x-trie-based-search-dialog...
B4A Question Sorting of distances in map values - Erel (first post)    Jan 19, 2023   (1 reaction)
Don't use a map. Create a custom type with the two fields. Add the items to a list and sort it with List.SortType....
Page: 1   2   3   4   5   6   7