This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



May 10, 2011, 2:34 PM
14 Posts
topic has been resolvedResolved

Using a view panel and trying to show number of responses

  • Category: Other
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags: Responses,Total
  • Replies: 2
 I have a view panel in a custom control displaying parent document titles. I added a column to the view panel and used the SSJS code (from the Openntf published discussion db only they use a repeat control with a computed field): 
 
var rc = rowData.getDescendantCount();

//
// "if" is requried for 
// workaround for IE CSS bug
if (rc > 0) {
"(" + parseInt(rc) + ")";
}
else {
" ";
}
 
This accurately returns the number of responses but the side effect is that is generates an additional row for each response under the parent (which I do not want to show). The view selection formula has  | @AllDescendants and the view properties has "show response documents in a hierarchy" checked off. Is there any way to pull in the response count without have the response doc rows visible?
 
Any help is appreciated, 
 
Thanks, 
 
Elijah Lapson 
May 10, 2011, 7:13 PM
261 Posts
Re: Using a view panel and trying to show number of responses
You could calculate the number of responses for every entry using:
rowData.getDocument().getResponses().getCount()
That way you don't need the @AllDescendants in the view selection.
 
This formula will calculate the responses probably a bit slower, but (depending on the size of your application) you might not even notice that.

Mark
May 10, 2011, 7:30 PM
14 Posts
Re: Using a view panel and trying to show number of responses
Performance smchmormance who cares. :) Thanks Mark works like a charm. You rock! 
 
FYI for formating purposes I used: 
 
"(" + rowData.getDocument().getResponses().getCount().toString()+ ")" 
 
Elijah 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal