How sort by complex field?
See original GitHub issueRealm 3.7.1
public class Contact extends RealmObject {
@PrimaryKey
private long id;
private String name;
}
If I want to get all contacts and sort by name I use the next method:
RealmResults<Contact> contactRealmResults = realm.where(Contact.class)
.findAllSorted("name");
And it’s work fine. OK.
Now the type of field Contact.name is change. The value of filed Contact.name is in TranslatedString.value
public class Company extends RealmObject {
@PrimaryKey
private long id;
private LocalizedString name;
}
public class LocalizedString extends RealmObject {
private RealmList<TranslatedString> translatedStringList = new RealmList<>();
}
public class TranslatedString extends RealmObject {
private String locale;
private String value;
}
So now I need to sort by field TranslatedString.value .
And how I can do this?
Issue Analytics
- State:
- Created 6 years ago
- Comments:21 (13 by maintainers)
Top Results From Across the Web
How do I sort complex numbers? - Mathematica Stack Exchange
There's no standard way to sort complex numbers. If you re-read your question, it should be obvious what's wrong with it.
Read more >Performing Complex Sorts - Excel Ribbon Tips
Display the Data tab of the ribbon. · Click the Sort tool. · Use the Sort By drop-down to select the field (or...
Read more >Sort Complex Numbers VI - NI
Sorts an array of complex numbers in ascending or descending order with respect to real and imaginary parts or magnitude.
Read more >Sort a list of complex numbers based on how far they are from ...
Code:clcz=input('Enter the array');Y=abs(z);Y=fliplr( sort (Y)) ... Sort a list of complex numbers based on how far they are from the origin.
Read more >SortbyColumns does not seem to work for a complex data type?
So I wonder if complex data types can be sorted? ... You might re-think if you actually need the complex field type involved...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@cmelchior or make a “composite” primary key by concatenating multiple fields into a single String
@lmdic I assume the above answered your question. If not, feel free to reopen.