Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Accordian - Is it possible set default to expand all?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Accordian - Is it possible set default to expand all?
 Login/Join
 
Platinum Member
posted
Hi,

I have an accordian report. I need the report to be expanded fully by default to the lowest level, but should have the option to go back to the highest level.

I have seen the following option using javascript to expand to a required level, but i cannot use that if i need to go back to the highest level. Please let me know.

SET STYLEMODE=PAGED

TABLE FILE CAR
PRINT
SALES RCOST DCOST
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE SET PAGE-NUM OFF
ON TABLE SET EXPANDABLE ON
ON TABLE NOTOTAL
ON TABLE HOLD AS TEST FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
LEFTMARGIN=0.250000,
RIGHTMARGIN=0.250000,
TOPMARGIN=0.250000,
BOTTOMMARGIN=0.250000,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
FONT='ARIAL',
SIZE=10,
COLOR='BLACK',
BACKCOLOR='NONE',
STYLE=NORMAL,
RIGHTGAP=0.125000,
$
TYPE=DATA,
SIZE=8,
BACKCOLOR=( RGB(234 234 255) 'WHITE' ),
$
TYPE=TITLE,
BORDER=LIGHT,
BORDER-STYLE=RIDGE,
BORDER-COLOR=RGB(51 51 153),
SIZE=9,
COLOR='WHITE',
BACKCOLOR=RGB(147 172 219),
STYLE=BOLD,
$
TYPE=TABHEADING,
SIZE=9,
STYLE=BOLD,
$
TYPE=TABFOOTING,
SIZE=9,
STYLE=BOLD,
$
TYPE=HEADING,
BORDER=LIGHT,
BORDER-STYLE=RIDGE,
BORDER-COLOR=RGB(51 51 153),
SIZE=12,
COLOR='WHITE',
BACKCOLOR=RGB(147 172 219),
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=HEADING,
LINE=1,
SIZE=14,
$
TYPE=FOOTING,
BORDER=LIGHT,
BORDER-STYLE=RIDGE,
BORDER-COLOR=RGB(51 51 153),
COLOR='WHITE',
BACKCOLOR=RGB(147 172 219),
STYLE=BOLD,
$
TYPE=SUBHEAD,
SIZE=9,
STYLE=BOLD,
$
TYPE=SUBFOOT,
BORDER=LIGHT,
BORDER-STYLE=RIDGE,
BORDER-COLOR=RGB(51 51 153),
SIZE=9,
COLOR='WHITE',
BACKCOLOR=RGB(147 172 219),
STYLE=BOLD,
$
TYPE=SUBTOTAL,
SIZE=8,
STYLE=BOLD,
$
TYPE=ACROSSVALUE,
SIZE=8,
STYLE=BOLD,
$
TYPE=ACROSSTITLE,
SIZE=8,
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
SIZE=9,
STYLE=BOLD,
$
ENDSTYLE
END

-HTMLFORM BEGIN


<script>
var columnsToOpen=3;


<script LANGUAGE='JAVASCRIPT'>
function clickItemsOpen()
{
var i=0;
var s='';
var t='';
var u='';

var allTD = document.getElementsByTagName('td');
var numTD = allTD.length;
for (i=0;i{
if (allTD[i].getElementsByTagName('img').length == 0)
continue;
if (allTD[i].getAttribute('ibiattr') == 0)
continue;
if (allTD[i].getAttribute('ibiattrc') > columnsToOpen)
continue;
s=allTD[i].getElementsByTagName('a');
t=s[0].getAttribute('href');
u=t.substring(11,t.length);
eval(u);
allTD[i].removeChild(s[0]);
}
if(navigator.userAgent.indexOf('Firefox')!=-1)
document.getElementsByTagName('table')[0].style.borderCollapse='separate';
}



!IBI.FIL.TEST;



-HTMLFORM END

This message has been edited. Last edited by: Kerry,


Regards,
Cyril Joy.

WF Production 8008 on Linux.
 
Posts: 143 | Location: Rochester,NY. | Registered: August 20, 2004Report This Post
Expert
posted Hide Post
Cyril,

Because you're HOLDing the report as HTML, the result is a complete web page. When the HTML file is dropped in to the HTMLFORM, it's not going to trigger anything else going on within the HTMLFORM. Do a View Source to see what the complete page looks like.

A quick solution is below. Move the !IBI.FIL to before your JavaScript and also add a window.onload event handler to trigger execution of your function. (There was a small error in the for statement):

SET STYLEMODE=PAGED

TABLE FILE CAR
PRINT
SALES RCOST DCOST
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE SET PAGE-NUM OFF
ON TABLE SET EXPANDABLE ON
ON TABLE NOTOTAL
ON TABLE HOLD AS TEST FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
LEFTMARGIN=0.250000,
RIGHTMARGIN=0.250000,
TOPMARGIN=0.250000,
BOTTOMMARGIN=0.250000,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
FONT='ARIAL',
SIZE=10,
COLOR='BLACK',
BACKCOLOR='NONE',
STYLE=NORMAL,
RIGHTGAP=0.125000,
$
TYPE=DATA,
SIZE=8,
BACKCOLOR=( RGB(234 234 255) 'WHITE' ),
$
TYPE=TITLE,
BORDER=LIGHT,
BORDER-STYLE=RIDGE,
BORDER-COLOR=RGB(51 51 153),
SIZE=9,
COLOR='WHITE',
BACKCOLOR=RGB(147 172 219),
STYLE=BOLD,
$
TYPE=TABHEADING,
SIZE=9,
STYLE=BOLD,
$
TYPE=TABFOOTING,
SIZE=9,
STYLE=BOLD,
$
TYPE=HEADING,
BORDER=LIGHT,
BORDER-STYLE=RIDGE,
BORDER-COLOR=RGB(51 51 153),
SIZE=12,
COLOR='WHITE',
BACKCOLOR=RGB(147 172 219),
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=HEADING,
LINE=1,
SIZE=14,
$
TYPE=FOOTING,
BORDER=LIGHT,
BORDER-STYLE=RIDGE,
BORDER-COLOR=RGB(51 51 153),
COLOR='WHITE',
BACKCOLOR=RGB(147 172 219),
STYLE=BOLD,
$
TYPE=SUBHEAD,
SIZE=9,
STYLE=BOLD,
$
TYPE=SUBFOOT,
BORDER=LIGHT,
BORDER-STYLE=RIDGE,
BORDER-COLOR=RGB(51 51 153),
SIZE=9,
COLOR='WHITE',
BACKCOLOR=RGB(147 172 219),
STYLE=BOLD,
$
TYPE=SUBTOTAL,
SIZE=8,
STYLE=BOLD,
$
TYPE=ACROSSVALUE,
SIZE=8,
STYLE=BOLD,
$
TYPE=ACROSSTITLE,
SIZE=8,
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
SIZE=9,
STYLE=BOLD,
$
ENDSTYLE
END
-RUN

-HTMLFORM BEGIN

!IBI.FIL.TEST;

<script type="text/javascript">
var columnsToOpen=3;

window.onload = clickItemsOpen;

function clickItemsOpen()
{
var i=0;
var s='';
var t='';
var u='';

var allTD = document.getElementsByTagName('td');

for (i=0; i<allTD.length; i++)
  {
  if (allTD[i].getElementsByTagName('img').length == 0)
  continue;
  if (allTD[i].getAttribute('ibiattr') == 0)
  continue;
  if (allTD[i].getAttribute('ibiattrc') > columnsToOpen)
  continue;
  s=allTD[i].getElementsByTagName('a');
  t=s[0].getAttribute('href');
  u=t.substring(11,t.length);
  eval(u);
  allTD[i].removeChild(s[0]);
  }

if(navigator.userAgent.indexOf('Firefox') != -1)
  document.getElementsByTagName('table')[0].style.borderCollapse='separate';
}
</script>

-HTMLFORM END

With this solution, the accordion report opens as you wanted, but the HTML page is not properly formed. For example, this is not proper:

...
</BODY>
</HTML>
 
<script type="text/javascript">
var columnsToOpen=3;
...
because < /HTML > indicates the end of the html, but there's more code...

To create a properly formed HTML file, I would use FORMAT HTMTABLE. This does not create the HTML and BODY tags, so you can plonk the HOLD file anywhere within an HTML page. Unfortunately, a little more code needs to be added to the page (this code is automatically generated when using FORMAT HTML);

SET STYLEMODE=PAGED

TABLE FILE CAR
PRINT
SALES RCOST DCOST
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE SET PAGE-NUM OFF
ON TABLE SET EXPANDABLE ON
ON TABLE NOTOTAL
ON TABLE HOLD AS TEST FORMAT HTMTABLE
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
LEFTMARGIN=0.250000,
RIGHTMARGIN=0.250000,
TOPMARGIN=0.250000,
BOTTOMMARGIN=0.250000,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
FONT='ARIAL',
SIZE=10,
COLOR='BLACK',
BACKCOLOR='NONE',
STYLE=NORMAL,
RIGHTGAP=0.125000,
$
TYPE=DATA,
SIZE=8,
BACKCOLOR=( RGB(234 234 255) 'WHITE' ),
$
TYPE=TITLE,
BORDER=LIGHT,
BORDER-STYLE=RIDGE,
BORDER-COLOR=RGB(51 51 153),
SIZE=9,
COLOR='WHITE',
BACKCOLOR=RGB(147 172 219),
STYLE=BOLD,
$
TYPE=TABHEADING,
SIZE=9,
STYLE=BOLD,
$
TYPE=TABFOOTING,
SIZE=9,
STYLE=BOLD,
$
TYPE=HEADING,
BORDER=LIGHT,
BORDER-STYLE=RIDGE,
BORDER-COLOR=RGB(51 51 153),
SIZE=12,
COLOR='WHITE',
BACKCOLOR=RGB(147 172 219),
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=HEADING,
LINE=1,
SIZE=14,
$
TYPE=FOOTING,
BORDER=LIGHT,
BORDER-STYLE=RIDGE,
BORDER-COLOR=RGB(51 51 153),
COLOR='WHITE',
BACKCOLOR=RGB(147 172 219),
STYLE=BOLD,
$
TYPE=SUBHEAD,
SIZE=9,
STYLE=BOLD,
$
TYPE=SUBFOOT,
BORDER=LIGHT,
BORDER-STYLE=RIDGE,
BORDER-COLOR=RGB(51 51 153),
SIZE=9,
COLOR='WHITE',
BACKCOLOR=RGB(147 172 219),
STYLE=BOLD,
$
TYPE=SUBTOTAL,
SIZE=8,
STYLE=BOLD,
$
TYPE=ACROSSVALUE,
SIZE=8,
STYLE=BOLD,
$
TYPE=ACROSSTITLE,
SIZE=8,
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
SIZE=9,
STYLE=BOLD,
$
ENDSTYLE
END
-RUN

-HTMLFORM BEGIN
<html>
<head>
<META name="HandheldFriendly" content="True">
<META name="PalmComputingPlatform" content="True">
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<TITLE>WebFOCUS Report</TITLE>
<BASE HREF="http://localhost:8080/approot/App/">
<script type="text/javascript">
var ibiOptions = new Array("expandable");
var focexurl = "/ibi_apps/WFServlet?";
var fochtmlurl = "/ibi_html";
var serverLanguage='en';
</script>
<script type="text/javascript" src='/ibi_html/javaassist/nls.js'></script>
<script type="text/javascript" src='/ibi_html/javaassist/ibi/html/js/ibigbl.js'></script>

<script type="text/javascript">
var columnsToOpen=3;

function clickItemsOpen()
{
var i=0;
var s='';
var t='';
var u='';

var allTD = document.getElementsByTagName('td');

for (i=0; i<allTD.length; i++)
  {
  if (allTD[i].getElementsByTagName('img').length == 0)
  continue;
  if (allTD[i].getAttribute('ibiattr') == 0)
  continue;
  if (allTD[i].getAttribute('ibiattrc') > columnsToOpen)
  continue;
  s=allTD[i].getElementsByTagName('a');
  t=s[0].getAttribute('href');
  u=t.substring(11,t.length);
  eval(u);
  allTD[i].removeChild(s[0]);
  }

if(navigator.userAgent.indexOf('Firefox') != -1)
  document.getElementsByTagName('table')[0].style.borderCollapse='separate';
}
</script>
</head>

<body onLoad="clickItemsOpen();">
!IBI.FIL.TEST;
</body>
</html>
-HTMLFORM END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
I think I did not mention the issue clearly:
If you run the following code, you can see that the report can be expanded to multiple levels. I need the initial report to be generated as expanded to the lowest level(BODYTYPE). Here you can see that I can colapse and expand to any level.

TABLE FILE CAR
SUM RETAIL_COST
BY COUNTRY
SUM RETAIL_COST
BY COUNTRY
BY CAR
SUM RETAIL_COST
BY COUNTRY
BY CAR
BY MODEL
SUM RETAIL_COST
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE SET EXPANDABLE ON
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
END
-EXIT


Regards,
Cyril Joy.

WF Production 8008 on Linux.
 
Posts: 143 | Location: Rochester,NY. | Registered: August 20, 2004Report This Post
Expert
posted Hide Post
TABLE FILE CAR
SUM RETAIL_COST
BY COUNTRY
SUM RETAIL_COST
BY COUNTRY
BY CAR
SUM RETAIL_COST
BY COUNTRY
BY CAR
BY MODEL
SUM RETAIL_COST
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE SET EXPANDABLE ON
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE HOLD AS H001 FORMAT HTML
END
-RUN

-HTMLFORM BEGIN
!IBI.FIL.H001;

<script type="text/javascript">

window.onload = openAll;

function openAll()
{
a = (document.getElementsByTagName("A"));

for (i=0; i<a.length; i++)
  {
  x = a[i].href;
  var f = x.split(':');
  eval(f[1]);
  }
}
</script>

-HTMLFORM END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
Wow.. Thanks!


Regards,
Cyril Joy.

WF Production 8008 on Linux.
 
Posts: 143 | Location: Rochester,NY. | Registered: August 20, 2004Report This Post
Expert
posted Hide Post
The function runs the JavaScript contained within the HREF of each ANCHOR (the toggle image). Because the HREF contains "javascript" (e.g.: javascript:toggle("table1","by_1_1_1");), I use the split function to split the href at the ":" and then execute the second part (e.g.: toggle("table1","by_1_1_1");).


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Accordian - Is it possible set default to expand all?

Copyright © 1996-2020 Information Builders