Okay, let's concentrate on sorting by name.
Name is a suffix of the Firebase tags, after your ListView1.Selection values.
It's not clear from your blocks what ListView1.Selection has.
To sort, you need to get from Firebase all the brothers and sisters of ListView1.Selection.
This would be requested by supplying an empty text as a tag, and checking for that when the data arrives.
In such a case, the arriving value would be a big dictionary keyed by all those possible Selection values (whatever they are.)
You can convert that dictionary into a table using this sample code:
The you can use the advanced sorting and filtering list blocks to rearrange the table before loading it into a ListView for display.
Just in case,