Hi, im trying to get SortBy to work with the LiveQuery:
The Query works as expected but the result is never sorted on the property.
I’ve set it up as folows:
PresentationQuery = QueryBuilder.Select(SelectResult.All(), SelectResult.Expression(Meta.ID))
.From(DataSource.Database(CouchbaseBridge.database))
.Where(Expression.Property(“session_key”).EqualTo(Expression.String(session.cbFileId))
.And(Expression.Property(“type”).EqualTo(Expression.String(“presentation”))));
PresentationQueryToken = PresentationQuery.AddChangeListener((s, e) =>
{
Dispatcher.UIThread.InvokeAsync(() =>
{
PresentationList.ClearAndDispose();
DateTime Start = session.time_start.DateTime;
foreach (var res in e.Results.AllResults())
{
var doc = ((DictionaryObject)res.GetValue(0)).ToObject<Presentation>(res.GetString(1));
Console.WriteLine($"Presentation Order: {doc.order}");
var presVm = new PresentationViewModel(doc);
presVm.Start = Start.ToShortTimeString().Replace("-", ":");
presVm.End = (Start = Start.AddMinutes((double)doc.duration.Minutes)).ToShortTimeString().Replace("-", ":");
PresentationList.Add(presVm);
}
});
});
PresentationQuery.OrderBy(Ordering.Property("order"));
PresentationQuery.Execute();
And my Document looks like this:
{
“duration”: 10,
“file_keys”: [
“-qGkQBZzyWkq8TPXs7cW4xA”,
“-S-Xau9FXsEadPR73SuNCyg”
],
“order”: 2,
“session_key”: “-GZU97Ejo0UqFJIe0ylaoGA”,
“speaker_keys”: [
“ffac397d7b29bb1671778453e9a63f48”,
“98d750ea404cbd53f7ae6c50cb7e094a”,
“794948a58067e26552193be205d35aa5”,
“0576d6c2a59945f0d2b7ae1d46900950”
],
“title”: “My first Presentation3”,
“type”: “presentation”
}