Forum Discussion

prashanthkavya's avatar
7 years ago

show only floated messages from the message list

Hi,  I want to find floated_messages for the post. i tried using the query for the same out not able to get through. I am also pasting the code that I have used.. Pls help. i am looping the message ...
  • saikumarn's avatar
    7 years ago

    Hi prashanthkavya,

    you missed the double quotes in floated_messages api and used plus symbols around message1.id . May below code will help.

     

    <ul>
    <#assign x= rest("2.0","/search?q=" + "SELECT * FROM messages where labels.text= 'featured' ORDER BY post_time DESC LIMIT 4"?url) />
    <#list x.data.items as message1>
    <li class="loop">
    <div class="list_txt">
    <span><a href="${message1.view_href}">${message1.subject}</a></span>
    <p>by <span style="background-color:#ac208d; color:#fff; padding:0px 5px">Admin</span> <a href="${message1.author.view_href}" class="black_font">${message1.author.login}</a></p>
    </div>
    <div class="lc_sec">
    <span class="count_nmbr">
    <#assign kudos_q= rest("2.0","/search?q=" + "${message1.kudos.query}"?url) />
    ${kudos_q.data.size}
    </span>
    </div>
    <div class="c_o">
    <span class="count_nmbr">
    <#assign replies_q= rest("2.0","/search?q=" + "${message1.replies.query}"?url) />
    ${replies_q.data.size}
    </span>
    </div>
    <div class="p_o">
    <#assign float_topics_q= rest("2.0","/search?q=" + "SELECT * FROM floated_messages WHERE message.id = '${message1.id}' AND scope='user'"?url) />
    <div>${float_topics_q.data.type}</div>
    <#list float_topics_q.data.items as float>
    <div>${float.subject},</div>
    </#list>
    </div>
    </li>
    </#list>
    </ul>

  • prashanthkavya's avatar
    prashanthkavya
    7 years ago

    Thanks Saikumarn This works