Forum Discussion

dustin's avatar
dustin
Expert
10 years ago

How do I display the kudos for a specific message in a custom component using freemarker?

  The following code will select the kudo information for a specific message, but I can't figure out how to display the weighted sum of the kudos using freemarker.  Any ideas?     <#assign kudos =...
  • PaoloT's avatar
    10 years ago

    Hi dustin

     

    have you tried retrieving the weighted sum directly

     

    SELECT kudos.sum(weight) FROM messages WHERE message.id = '100' 

    So the freemarker would be

    <#assign response = rest("2.0","/search?q=" + "SELECT kudos.sum(weight) FROM messages WHERE id = '100'"?url).data.items />
    ${response[0].kudos.sum.weight}

    Hope it helps