Hello @elbranscomb You need to paste the code in the same component you have query for pulling messages content and then update your query like below. like pull data for messages like below:
<#assign baseQry = "SELECT id, subject, body, metrics.views, tags, labels, images, post_time, post_time_friendly, conversation.last_post_time, moderation_status, conversation.last_post_time_friendly, author.login, author.avatar.message, view_href, author.view_href, read_only, author.rank.name, author.rank.color, author.rank.icon_left, author.rank.bold, author.rank.icon_right, author.online_status,board.id, author.avatar.profile, board.view_href, board.title, replies.count(*), kudos.sum(weight), conversation.solved, user_context.read FROM messages WHERE depth = 0 AND board.id = '${coreNode.id}' " />
Now add the following code to the same component below above code:
<#switch sorting>
<#case "kudos">
<#assign orderIt = "ORDER BY kudos.sum(weight) DESC " />
<#break>
<#case "views">
<#assign orderIt = "ORDER BY metrics.views DESC " />
<#break>
<#case "replies">
<#assign orderIt = "ORDER BY replies.count(*) DESC " />
<#break>
<#case "post_time">
<#assign orderIt = "ORDER BY post_time DESC " />
<#break>
<#case "unaswered">
<#assign orderIt = "AND replies.count(*)=0 ORDER BY post_time DESC " />
<#break>
<#case "no_solution">
<#assign orderIt = "AND conversation.solved=false ORDER BY post_time DESC " />
<#break>
<#default>
<#assign orderIt = "ORDER BY conversation.last_post_time DESC " />
<#break>
</#switch>
Now add the following line below this:
<#assign qry = baseQry + orderIt />
Now execute the above LiQL like below:
<#assign topics = executeLiQLQuery(qry) />
Now the above query will execute whichever case you selected from UI and pass to switch case as a sorting parameter. Later it will pull the data in required format and display. Regards, Abhishek Gupta
... View more