It would be great to have the posibility to sort on a Link.
ie.:
RealmResults
fooRealmResults.sort("bar.startTimeStamp");
Absolutely - thanks for the suggestion!
:+1: :)
:+1: :smiley:
+1
:+1:
+1
In my case, I wish to retrieve a list of A sorted by A.date with its childs sorted by B.date, where:
Class A {
int id;
Date date;
RealmList<B> bList;
}
Class B {
int id;
Date date;
}
Example query:
RealmResults<A> results= realm.where(A.class)
.findAllSorted(new String[]{"date", "bList.date"}, new Sort[]{Sort.ASCENDING, Sort.ASCENDING});
+1
+1 as well. I have a lot of redundant fields that duplicates data in their children for sorting purposes. Updating all these values is a bit of a pain.
+1
+15 from #709
@cmelchior is there any timeline for this or a recommended workaround? I have a similar case where i have an array of child objects with a date property, thanks.
:+1: I'm currently in the process of migrating an app from SQLite to Realm and I was kind of expecting that this would work. Since it doesn't I'm currently a bit stuck and need to wait till this is implemented. Any news on this? Is this being worked on? Thanks!
+1
+1
+1
+1 this is really important - do you guys know when this is scheduled in for? Need to know whether I should wait, or implement a workaround now.
+1
+1
+1
+1
+1
Move to P1 since it is supported from core.
Is there any estimated release date for this feature? Shouldn't be too difficult as it's already part of the core.
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
This is extremely important to my project, I was able to reduce file size of realm to peanuts by removing duplicate fields which could be found in child realmobjects, until I noticed I couldn't sort by child.
I have a RecyclerView with icons on the left grouping items by category, and my flow is similar to:
a- Artist
b- Album
c- Song Title
Is it expected to be added within the next release? I need to know if possible, thanks.
Also noticed that I can't return a .distinct("artist.album") :/
If you have a link to the Artist
from the Album
, then you can search for the album via link queries and then sort directly on the album's property
Unfortunately no I don't, I gave random classes now just as an example, the one I'm currently working on is this:
A- ShoppingItem
B- Food
C- String category.
The shopping list used to be sorted by fetching each shoppingItem, getting the Food object and extracting the food.category, something such as realm.where(ShoppingItem.class).findAllSorted("food.category",Sort.Ascending);
which doesn't work. My workaroound was to put a category also under shoppingItem each time a shoppingItem was created from a food. But then the link is not dynamic, each time the food's category is changed, i have to manually change the category of each shoppingItem related to it.
+1
+1
+1
Another possible solution here would be to allow passing a comparator function into sort. Then sorting by child fields becomes implementable on the client side. Given that sort appears to be implemented in native code, this might not be practical - but just wanted to suggest it as a possible approach here.
@tmtrademarked https://github.com/realm/realm-java/issues/2313
+1
+1
It's a bit disappointing having to wait 2 years for feature that should have been there from start. :)
+1
+1
+1
+1
v2.4.0
. For anyone wants to try it now, the 2.4.0-SNAPSHOT
should include this feature.
Most helpful comment
3834 is merged to master. will be fixed in
v2.4.0
. For anyone wants to try it now, the2.4.0-SNAPSHOT
should include this feature.