Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to dynamically add a group to table with header and count using script
Peyman
Hi,<br />
<br />
I want to add a group to a table using script, but i cannot make it show the group header name.<br />
here is what i use for grouping, it groups them together but does not show group header in each group.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
g = elementFactory.newTableGroup();
g.setKeyExpr("dataSetRow[\"mydata\"]");
g.setSortDirection("asc");
tableHandle.getGroups().add(g);
</pre>
<br />
it seems it needs a header label or something like that but I don't know how to access and add header to group. I tried below code but got null exception.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>tr = elementFactory.newTableRow(1);
cell = tr.getCells().get(0);
label = elementFactory.newLabel( "mydata" );
label.setText("dataSetRow[\"mydata\"]");
cell.getContent().add( label );
g.getHeader().add(cell);
</pre>
Find more posts tagged with
Comments
mwilliams
One simple way to add a group dynamically would be to insert a group using the designer and just use an expression. Then you could display the value in the group header or display nothing based on the same expression used to group or not. Hopefully this makes sense.