Hi,
I am trying to implement expand and collapse feature in a crosstab report. I have found that configuration parameter (VIEWER_JS_EXPAND_COLLAPSE_CONTROLS_DEFAULT) can be changed to achieve this.
However this works as long as I create the report by just drag and drop data items in the report. If I do any modifications to any of those data items, this doesn't work anymore.
Does any has any experience in achieving expand collapse hierarchy using this configuration or any other way to achieve this feature?
Any insight will be appreciated!
This is one of the frustrating things with extended data items. Is there a reason you're looking for a solution without JavaScript? Would JS that uses the Prompt API (and is therefor IBM supported) be okay?
Thanks for the response. I am not an expert in using JS or prompt API. But I would like to try JS that uses prompt API if you have any solution.
Also, a little bit more on the environment here; I am using Cognos 11.3 with TM1 as the source.
The reason for not using JS is because the Client is skeptical about it.
Thanks!
C11 does change things a bit. Are you using interactive mode? If you aren't, this solution should still work:
http://cognospaul.com/2014/09/29/expand-collapse-cognos/
If you are, it's on my list of solutions to migrate, but it won't be ready for at least another month.
When all browsers support HTML5, you will be able to do this using the <details> tag. Until then you'll need to use Javascript.
When you can use the API it's always better to do so. However, don't shy away from leveraging other Javascript libraries as well. CA 11 has significantly changed the way JS is implemented (for better), and it already comes with the jQuery library without conflict.
Thanks CognosPaul. Let me give this in my model.
I wouldn't recommend doing it without javascript, but you're still looking for a way...
You could always put what you want to hide in a conditional block. Then add a drill-through to the same report which passes a value that the conditional block uses to determine show/hide. Big issue with this would be it has to generate the report again so i definitely wouldn't recommend this method.
Have you tried using a render variable?
Create a checkbox prompt with a single option (e.g. use: 1, display "Show") and default set to 0.
Create a variable that is true/yes when checkbox option = 1.
Apply the variable as the render var for the object to show/hide. Deselect the box to hide, select to show.
Hi CognosPaul,
Regarding your reply to this topic on Mar 24, 2017, have you made any progress migrating the JS expand/collapse functionality to CA 11 for Interactive mode?
Thanks!
Check it out: http://www.pmsquare.com/main/blog/custom-javascript-in-cognos-expand-and-collapse/
(https://i2.wp.com/www.pmsquare.com/main/wp-content/uploads/2017/09/6.-expandInAction-1.gif) (http://www.pmsquare.com/main/blog/custom-javascript-in-cognos-expand-and-collapse/)
Unless you're specifically asking about the one that uses the mun to expand and collapse. Haven't had a chance to adapt that one yet.
Paul,
I checked the link you provided with the sample report. Can you please provide the .js file as well?
Thanks!
Quote from: CognosPaul on 22 Feb 2018 11:21:36 AM
Check it out: http://www.pmsquare.com/main/blog/custom-javascript-in-cognos-expand-and-collapse/
(https://i2.wp.com/www.pmsquare.com/main/wp-content/uploads/2017/09/6.-expandInAction-1.gif) (http://www.pmsquare.com/main/blog/custom-javascript-in-cognos-expand-and-collapse/)
Unless you're specifically asking about the one that uses the mun to expand and collapse. Haven't had a chance to adapt that one yet.
Hey
I am getting this error
Failed to Load Module
script error
anybody tried this solution?
It works great for me. Are you storing the JS files in a place that's accessible to your browser? The module location should be a fully qualified path - relative paths tend to cause problems when switching from Report Studio to viewer.
Quote from: Cognos123!!! on 19 Mar 2018 12:21:32 AM
Paul,
I checked the link you provided with the sample report. Can you please provide the .js file as well?
Thanks!
Just noticed this now. The link should now provide both the report XML and JS. Previously it would alternate between the report.txt and expandCollapse.js because of weirdness with the download widget being used.
Hey Paul,
Have you managed to create a expand and collapse that is compatible with interactive mode (custom control) ? because this only works in non-interactive mode ?
Hi Oscar,
This was actually designed for Interactive mode. Is it not working for you? What error are you getting?
Hey Paul,
I havent tried it yet but its embedded javascript right ? and thought that you should avoid that when using interactive mode. I'll try to use it because this could be a really good option/solution if the report can't generate lowest detailed levels at once due to performance issues as I have encountered before.
I just tried the script and get the error:
"Method not found: Draw"
I noticed now that the draw method was correlated to the UI-type and since the javascript doesnt contain a draw method it shouldnt use a UI-type.
But one weird thing with the javascript is that when I run the report and expand the levels the whole crosstab is slightly moving a little bit back and forth depending on if i expand or collapse which is somewhat annoying.
*****Solved it with "No wrap"*****
When I try to do it on time dimension:
descendants(
[CBI Sales].[Date].[Year - Month - Day].[Year],[CBI Sales].[Date].[Year - Month - Day].[Year Month Day],
self beforewithmember
)
it only displays +2006 in the crosstab but it should display:
+2006
+2007
+2008
+2009
etc
No matter on what dimension I do it on it only displays the first member in the level (2006 being the first member in the Year- Monh - Day level)
*Bump*
Is the padding set up to "based on the level of the hierarchy"? Indentation type based on relative works incorrectly.
If that's set up correctly, attach the report xml. I'll take a look.
Hey Paul,
I'll attach the XML here:
Two possibilities.
1. In the sample you gave you were filtering on a single year.
2. Make sure the crosstab isn't paginating. Easiest way is to select the crosstab, open pagination from the properties, and invert the checks. Check "Repeat every page" and uncheck both "allow" options.
It works now!!
Thank you Paul, you are truly great as always.
The expand/collapse is an out-of-the-box feature in Report Studio so it should still be available in C11.
Click on 'Drill options' and there are different settings to choose from. I used this quiet a while ago so don't remember completely but one of those settings was 'preserve' which would keep the higher level visible on the report when you expand to see the lower level.
The drill options were neutered in C11 interactive mode unfortunately. I've raised the issue and hopefully we'll get the drill options back at some point.