Forum Discussion
Is it any updates on this?
I need to sort API call from a specific board by last_time_edit?
Is it any way around to make it work?
It should be just the original tkb post that edited, not comments.
any suggestions on this?
Thank you.
I have posted Idea for the same https://community.lithium.com/t5/Product-Ideas/Sort-Messages-by-last-edit-time/idi-p/332003 which is Acknowledged by lithium.
- SuzieH8 years agoKhoros Alumni (Retired)
HI irach15,
TariqHussain is correct in that we don't have a way to support this at this time. We don't have a good workaround for you, unfortunately.
- irach158 years agoMaven
this is what I've coded, the way around
- API call to get the latest tkb from a specific board
- create an object of the data you need to show
- push data to the object
- sort the data by using FreeMarker sort_by
- reverse to be decending
it works for the task I've been working on
<#attempt> <#assign apiVersion = "2.0"/> <#assign messages = rest(apiVersion,"/search?q=" + "SELECT id, body, subject, view_href, post_time, post_time_friendly, board.id, board.view_href, board.title, board, images, images.count(*), videos.count(*), attachments.count(*), current_revision.last_edit_time FROM messages WHERE board.id = '${boardID}' AND depth=0 ORDER BY post_time DESC LIMIT 5"?url) /> <#recover> <p>Woops...</p> </#attempt> <#assign sortedMessagesList = [] /> <#if messages.data.items ?? > <#list messages.data.items as message > <#assign sortedMessagesList = sortedMessagesList + [{'message_subject': message.subject , 'message_revision_time':message.current_revision.last_edit_time}] /> </#list> <#list sortedMessagesList?sort_by("message_revision_time")?reverse as mes > <p>- ${mes.message_subject}: ${mes.message_revision_time}</p> </#list> </#if>
- TariqHussain8 years agoBoss
irach15- Thanks for sharing this code. However, this will for specific range e.g latest or oldest or for specific limit e.g 1000 messages.
Example someone has edited a message which was posted 3 years ago. There is no way to get it unless we store all the messages in the object.
Related Content
- 7 years ago
- 6 months ago
- 11 years ago
- 10 years ago