Sorting Events and using Query API
I am attempting to use the Query API to pull current and past events, but I am running into an issue with the sorting. I want to have the events on each page sorted with the closest events first. I am not using the Start Date or End Date since they affect the publishing of the event pages, and sorting by the creation date also doesn't always work, so that leaves me kind of in a pickle. Based on what I have read so far, there appears to be no way to sort by a structuredDataNode, so I'm wondering if what I am attempting to do is even possible.
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Ryan Griffith on 20 Jul, 2015 12:25 PM
Hi Phillip,
You are correct, the Query Tool currently only supports sorting by wired metadata fields, so you won't be able to use the tool to sort your events. I believe we have an improvement logged internally for such a feature, though.
That being said, your best bet would be to loop over the results of the Query Tool and generate a new array of objects that contains a key for your structured data field and use the Sort tool to sort the new array. Something like the following:
Please let me know if you have any questions.
Thanks!
Tim closed this discussion on 12 Aug, 2015 01:40 PM.