Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
script not working in Cross tab
Bea Haazen
Hi,
I have an ON CREATE script that works fine when used on a detail cell in a Table:
this.getStyle().setBackgroundColor("#" + this.getRowData().getColumnValue("CompIdxColor").toString());
this.getStyle().setColor("#" + this.getRowData().getColumnValue("CompIdxColor").toString());
this gives the cell a color depending on the ColumnValue found.
exactly the same script on the same detail cell does not work when the detail cell is an a Cross Tab instead of a Table.
any ideas why?
tx, Bea
Find more posts tagged with
Comments
mwilliams
Select your crosstab, go to the script tab, go to the onCreate, and enter something like:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
function onCreateCell( cellInst, reportContext )
{
if (cellInst.getCellID() == yourMeasureCellId){ // look in property editor with cell selected to find.
cellInst.getStyle().setBackgroundColor("#" + cellInst.getDataValue("CompIdxColor_Group2/Group2Name_Group/GroupName"));
cellInst.getStyle().setColor("#" + cellInst.getDataValue("CompIdxColor_Group2/Group2Name_Group/GroupName"));
}
}
</pre>
Bea Haazen
Hi Michael,
found the name of the cell and entered the following on create script on the cross tab :
function onCreateCell( cellInst, reportContext ) {
if (cellInst.getCellID()== 62){
cellInst.getStyle().setBackgroundColor("#" + cellInst.getDataValue("CompIdxColor_MeasureName/MeasureName_PeriodName/PeriodName"));
cellInst.getStyle().setColor("#" + cellInst.getDataValue("CompIdxColor_MeasureName/MeasureName_PeriodName/PeriodName"));
}
}
but the script doesn't return anything, not even an error.
btw, I'm working on version 11.0.3
mwilliams
Here's an example. Make sure you're selecting onCreate from the drop down, not just using the onCreate function.
Bea Haazen
Hi Michael, that's what I did. rptdesign enclosed.
enclosed also a screenshot of my preview. the color codes in the last column should actually color the cell according to the value found in that column.
thanks for looking into this.
Bea
mwilliams
The cell number is 61. The data element is 62. In your script, change the 62 to 61 and you should get the expected output.