Get the count of Discussion and Question in telligent 8.

I am able to get the no. of forum in a particular group, but i want filter it with total no. of "Discussion" and "Question" in separate column. I am using the below code, please suggest

#set($pagedListResponse = $core_v2_group.List("%{ GroupTypes = 'Joinless'}"))
#foreach ($GroupName in $pagedListResponse)
    #set($thread = $core_v2_forum.List("%{GroupId =$GroupName.Id }"))
    #foreach ($y in $thread)
        <div class="col-xs-12 col-sm-6 table-column application-title">
        <div class="col-sm-6 table-column post-date">

  • #set($thread = $core_v2_forum.List("%{GroupId =$GroupName.Id }"))

    Just to be clear, this lists forums. It does not retrieve a thread or list of threads. To list threads, use the core_v2_forumThread.List() API.

    And to get a count of all threads in a given forum, you can also use that same API.

    #set($threads = $core_v2_forumThread.List("%{ ForumId = YOUR_FORUM_ID, PageSize = 1, PageIndex = 0,  }"))
    Total Count: $threads.TotalCount

    The pattern of PageIndex:0, PageSize:1 is the recommended approach for getting list summaries from most APIs.

  • Thankyou Michael for your quick response.

    I would like to mention here that I don't want thread count. (I am assuming thread count is no. of replies in a particular forum).

    First, I want no. of forum in a particular group, which I am getting from above code.

    Now, I want to be filter those forum in "Discussions" and "Questions". 

    For example: I have one group called "Sales" and it has 20 forums(which include both "Discussion" and "Question"), now i wanted to filter those 20 forums, that how many are "Discussions" and how many are "Questions". I want the count of both.

  • I think maybe you do want thread count.

    Thread count is the number of threads, not number of replies. A forum has many threads. A thread has many replies. A thread is either a discussion or question. So you're looking for the count of threads in forums, which you can get with $core_v2_forumThread.List. You can also filter that call to only a specific type with the IncludeQuestions and IncludeDiscussions options.

  • Thankyou Michael for helping me out. One more query i have, now i am able to get the no. of thread count and able to filter the same with the help of below code.

    #if($checkEvent =='Discussions vs Q/A')
                        #set($pagedListResponse = $core_v2_group.List("%{ GroupTypes = 'Joinless', PageIndex = $pageIndex, PageSize = $pageSize}"))
                        #foreach ($GroupName in $pagedListResponse)
                            #set($all_qstns = $msd_threadQuery.ListThreads("%{MyDiscussions='False', GroupId=$GroupName.Id, ThreadStatus='allq}"))
                            #set($all_discussions = $msd_threadQuery.ListThreads("%{MyDiscussions='False', GroupId=$GroupName.Id, ThreadStatus='alld'}"))
                                <div class="row table-item">                        
                                    <div class="col-xs-4 col-sm-6 table-column group_name post-date">
                                    <div class="col-xs-4 col-sm-3 table-column all_questions post-date">
                                    <div class="col-xs-4 col-sm-3 table-column all_discussions post-date">
    Also i have added pagination for the same as you can see in below code.
    #if($checkEvent =='Suggested vs opening questions' || $checkEvent == 'Discussions vs Q/A' )
        <div class="custom-post-listing-pager">
            $core_v2_ui.Pager($pageIndex,$pageSize, $pagedListResponse.TotalCount, "%{ShowPrevious='true',ShowNext='true',ShowFirst='false',ShowLast='false'}") 
    But i want all the records without pagination, so i can export that data into excel in one go with the help of DOM. Now problem is that widget API restrict only 100 no. of records. 
    So how can i implement loop in that. Please suggest.