keithkelly
3 years agoLeader
Quickest way to get "unanswered topic count" in a board list?
Given the scope "board" what's the best practice to grab the # of topics without replies?
another rest() call? Or is there some sort of magic I can use in the LIQL query to grab this?
See
${board.UNANSWERED_TOPICS_COUNT}in the context below:
<#assign resp = liql("select title, id, description, depth, href, view_href, node_type, views, topics, messages.count(*), topics.count(*) from boards WHERE parent_category.id='${cat.id}' LIMIT 5000") />
  <#list resp.data.items as board>
       
    <#assign replies_nr = rest("/boards/id/" + board.id + "/replies/count").value?number />   
    <#assign board_subs_nr = rest("/boards/id/" + board.id + "/subscribers/email/board/count").value?number /> 
    <#assign board_scope = restadmin("/boards/id/" + board.id + "/settings/name/custom.dc_scope").value />
    
    <tr class="ind-${board?index}">
      <td>${cat.title}</td>
      <td><a href="${board.view_href}" target="_blank">${board.title}</a></td>
      <td>${board.topics.count}</td>
      <td>${replies_nr}</td>
      <td>${board.messages.count}</td>
      <td>${board.UNANSWERED_TOPICS_COUNT}</td>
      <td>${board_subs_nr}</td>
      <td>${board_scope}</td>
      <td>${board.id}</td>
    </tr>
    
  </#list>
keithkelly You can try this -
liql("Select count(*) from messages where replies.count(*)=0 and depth=0 and board.id='[BOARDID]'").data.countf you appreciate my efforts, please give me a kudo ↓
Accept as solution to help others find it faster.