Hi all, is there a way to sort by time using _eval...
# community-help
m
Hi all, is there a way to sort by time using _eval e.g. _eval(now()-startTime)
k
👋 any reason for using eval here instead of just using sort by condition on the field?
m
I'm trying to get the distance from the current time to show relevant events, e.g. events are more relevant as they come close to the current time
k
Got it. We don't have a way to do that.
m
Ahhh - that's tough. Is there a list of support commands for _eval?
k
Eval only does filtering operations. So equals, less than, greater than etc. Here you need to do a subtraction and also on now() which is a dynamic value.
m
I'm happy to pass my own epoch in, but yes subtraction is required!
k
Our filtering language doesn't support evaluation of arithmetic expressions. So 😔
m
Thanks for letting me know, will have to work something else out - appreciate your quick response!
👍 1
y
if your events are only in one direction (future events or past events), can't you combine a filter_by: startTime > (or <) timestamp and a sort_by: startTime:asc (or desc) ?