dustin
10 years agoExpert
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 = rest("2.0","/search?q=" + "SELECT * FROM kudos WHERE message.id = '100'"?url).data.items />
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