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)
Cross Tab Formatting
birtprofi
Find more posts tagged with
Comments
mwilliams
Think you can put together a quick example with the sample database or a flat file, that I can run and test on, that has your issue?
birtprofi
Hi Michael,<br />
<br />
I made a new sample report and within this, the script to design my border works correct. So I tried different things and now I have solved my problem. But I dont know why. Because normally javascript work the code from first to last. See my commentar //first and //second<br />
<br />
So If I made a function like this:<br />
(With this the border line don?t works correct)<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
function onCreateCell( cellInst, reportContext )
{
//first set the background color of summarize/measure field and invert the color to black or white
if( cellInst.getCellID() == 4703)
{
var nr = reportContext.evaluate("measure['Dienstplan::DP_COLOR']");
if (nr != null)
{
var hex=""+hexe(nr);
cellInst.getStyle().setBackgroundColor("#"+hex);
}
if (nr == null){
cellInst.getStyle().setBackgroundColor("white");
}
}
if( cellInst.getCellID() == 4703)
{
if (rgbinvert(nr) > 127)
{
cellInst.getStyle().setColor("black");
}
else {
cellInst.getStyle().setColor("white");
}
}
// second draw the border line
if( cellInst.getCellID() == 4703)
{
var linie = reportContext.evaluate("dimension['Group2']['Day Of Week']");
if (linie == 7)
{
cellInst.getStyle().borderRightStyle = "solid";
cellInst.getStyle().borderRightWidth = "medium";
cellInst.getStyle().borderRightColor = "black";
}
}</pre>
<br />
But if I change the first and second script, then everything works perfect:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>function onCreateCell( cellInst, reportContext )
{
// second draw the border line
if( cellInst.getCellID() == 4703)
{
var linie = reportContext.evaluate("dimension['Group2']['Day Of Week']");
if (linie == 7)
{
cellInst.getStyle().borderRightStyle = "solid";
cellInst.getStyle().borderRightWidth = "medium";
cellInst.getStyle().borderRightColor = "black";
}
//first set the background color of summarize/measure field and invert the color to black or white
if( cellInst.getCellID() == 4703)
{
var nr = reportContext.evaluate("measure['Dienstplan::DP_COLOR']");
if (nr != null)
{
var hex=""+hexe(nr);
cellInst.getStyle().setBackgroundColor("#"+hex);
}
if (nr == null){
cellInst.getStyle().setBackgroundColor("white");
}
}
if( cellInst.getCellID() == 4703)
{
if (rgbinvert(nr) > 127)
{
cellInst.getStyle().setColor("black");
}
else {
cellInst.getStyle().setColor("white");
}
}
</pre>
If someone is interested I have attached the sample report without color, but with the border line on day 7 of each week, with the sample database and scripted date Database. (for tests use 01.01.2005 - 31.01.2005) -> Report Version 3.7.0<br />
<br />
best regards<br />
Rafael