Forum Discussion
7 Replies
ronaksomani - Try this instead, you dont need to use V2 for this, simple if condition can do this.
<#if boardID != "exclude_board">
//run you query here
SELECT * FROM messages WHERE board.id = 'boardID'
</#if>- ronaksomani10 years agoMentor
VarunGrazitti : Can I pass list of board-ids to that if condition? As my requirement is to filter all those posts which have mentioned board-ids. Here I can have multiple board-ids which I want to filter.
ronaksomani - how long is the list of the boards to exclude? you can use or condition as below:
<#if boardID != "exclude_bd1" || boardID != "exclude_bd2" || boardID != "exclude_bd3">
</#if>
- ronaksomani10 years agoMentor
VarunGrazitti :List can have n number of board ids ranging any where from 0-25. So would perefer if there is any other solution for same. May be something like SELECT * FROM messages WHERE board.id NOT IN ('board-name'). NOT IN is part of SQL query. Is there any alternatives for this?
a more maintainable version:
<#assign excIds = ["Id1", "Id2","Id3"] /> <#if excIds?seq_index_of(boardId)== -1 > //do something here </#if>
- irach158 years agoMaven
did you find how to do this?
I need it too, looking around and not able to find a simple one API call for all tkbs in specific category, all boards except one specific board.
ronaksomani irach15 There is no such query which can help you out to exclude specific board/category. But alternatively, you can achieve it by using change in community structure.
Option 1:
Like you can create 2 categories i.e. Category1 & Category2.
Category1 will contain boards which you want to exclude. Category2 will contain rest of the boards.Now you can use the query
Select * from message where category.id='Category2'Option 2:
<#assign excIds = ["Id1", "Id2","Id3"] />
<#assign boards = rest( "2.0", "/search?q=" + "select * from boards"?url).data />
<#list boards.items as board>
<#if excIds?seq_index_of(board.id)== -1 >
//do something here
</#if>
</#list>
Related Content
- 5 months ago
- 2 years ago
- 2 years ago