realm-java icon indicating copy to clipboard operation
realm-java copied to clipboard

sort by columns with CASE_INSENSITIVE

Open xperad opened this issue 9 years ago • 5 comments

Is there a way to sort by columns with case sensitive or case insensitive?

ex)

realm.where(MyTable.class)
    .equalTo("column1", "value1")
    .findAllSorted("column2", Sort.ASCENDING, CASE.SENSITIVE);

if no, I hope this function with non-ASCII strongly :)

xperad avatar Feb 17 '16 02:02 xperad

Unfortunately sorting with case insensitive is not supported right now :(

beeender avatar Feb 17 '16 03:02 beeender

@beeender Is there any good workaround you could suggest for this? i.e., some way to make the values all upper-/lower-case before the sort happens (but not persist that change to the actual objects)?

My only idea was storing an extra copy of such fields that I'd converted to all lower-case, but that seemed like overkill just to provide case-insensitive sorting, so I figured I'd ask.

bkromhout avatar Feb 19 '16 17:02 bkromhout

My only idea was storing an extra copy of such fields that I'd converted to all lower-case, but that seemed like overkill just to provide case-insensitive sorting, so I figured I'd ask.

@bkromhout Yeah, this is what comes to my mind as well... I don't have other better workaround right now...

beeender avatar Feb 22 '16 01:02 beeender

That's fine, I've implemented it that way and it works, just have to remember to update that extra sort field if I update the real one.

bkromhout avatar Feb 22 '16 04:02 bkromhout

Have there been any updates to this issue?

inPhilly avatar Jun 12 '17 13:06 inPhilly