Home
Analytics
Change dynamically background color of cells
Miss_Anonymus
<p>Hello,</p>
<p> </p>
<p>I have the following problem: I would like to illustrate a table in an report, which says, who already paid for something, who hasn't paid yet, and who paid too late. So I have, for example, the following result from my data set (query on db):</p>
<p> </p>
<p><strong>Name Month DayPaid LastChance</strong></p>
<p>Lisa January 0 20150131</p>
<p>Laura January 0 20150131</p>
<p>Tim January 20150108 20150131</p>
<p>Lisa February 20150301 20150228</p>
<p>Laura February 0 20150228</p>
<p>Tim February 20150315 20150228</p>
<p> </p>
<p>If someone paid punctual, the cell should be green. If someone hasn't paid yet (DayPaid is 0), the cell should be red. If someone paid, but too late (DayPaid is higher than the LastChange mark), the cell should be yellow. </p>
<p> </p>
<p>This should be the result:</p>
<p> </p>
<p><strong>Name January February</strong></p>
<p>Lisa red yellow</p>
<p>Laura red red</p>
<p>Tim green yellow</p>
<p> </p>
<p> </p>
<p> </p>
<p>How can I do that? the problem is, that the range of month should be dynamically over report parameters, it can be 2 months, but it can also be 6 months (but not more than 12 months, i checked this before with a plausibility, otherwise the page would be to small). It depends on how the user tunes it. </p>
<p> </p>
<p>How can I implement the range of month above and underneath it the cells with the colors??</p>
<p>I am at a loss.</p>
<p> </p>
<p>Thanks already for your help!</p>
<p> </p>
Find more posts tagged with
Comments
Miss_Anonymus
<p>Hello,</p>
<p> </p>
<p>I have the following problem: I would like to illustrate a table with persons, who have already paid for something, who haven't paid yet, and who paid, but too late. From my db query I have the follwowing result from my DataSet:</p>
<p> </p>
<p> </p>
<p><strong>Name Month DayPaid LastChance</strong></p>
<p>Lisa January 0 20150131</p>
<p>Laura January 0 20150131</p>
<p>Tom January 20150601 20150131</p>
<p>Lisa February 20150304 20150228</p>
<p>Laura February 20150304 20150228</p>
<p>Tom February 0 20150228</p>
<p> </p>
<p> </p>
<p>The cells of the ones who paid correctly (DayPaid < LastChance, DayPaid != 0) should be green.</p>
<p>The cells of the ones who didn't pay yet (DayPaid = 0) should be red.</p>
<p>The cells of the ones who paid, but too late (DayPaid > LastChance) should be yellow.</p>
<p> </p>
<p>So, the result should be the table on the report as following:</p>
<p> </p>
<p> </p>
<p><strong>Name January February</strong></p>
<p>Lisa red yellow</p>
<p>Laura red yellow</p>
<p>Tom green red </p>
<p> </p>
<p> </p>
<p>How can I implement this in a table? the problem is, that the number of months can be variable, it can be 2 Months, but, if the user want it so, also 6 months. This is given by report parameter. Maximum are 12 Months (already checked before with a plausability check), otherwise the sheet would be too small and the table too big.</p>
<p> </p>
<p>I am at a loss.</p>
<p> </p>
<p>Thanks already for your help!</p>
<p> </p>
<p> </p>
shamo
<p>Hi, you can achieve that by clicking on the cell and under the properties click on highlight - add - and apply your conditions and colors. Hope this helps</p>
JFreeman
<p>My first thought is to use a crosstab.</p>
<p> </p>
<p>Make the months columns, the names rows (assuming the names are unique) and the summary field will be where you set the colors. Then you will use scripting in the summary field to determine the appropriate color and then set the value/highlighting color accordingly.</p>
<p> </p>
<p>Edit: it looks like there were two separate threads created for this question. I have merged them together.</p>
Clement Wong
<p>There are several ways that we can transform your original table to the desired table. As Jesse mentioned, one of them is a cross tab, in which you'll need to use a Data Cube.</p>
<p> </p>
<p>Another method, and depending on your database, you can transform your table in your database. For example, SQL Server supports the <a data-ipb='nomediaparse' href='
https://technet.microsoft.com/en-US/library/ms177410(v=SQL.105).aspx'>PIVOT
</a>function. And so does <a data-ipb='nomediaparse' href='
http://www.oracle.com/technetwork/articles/sql/11g-pivot-097235.html'>Oracle</a>.</p>
;
<p> </p>
<p>A third method, if your database cannot support pivoting/transposing, would require some scripting in your report design. You can make a copy of the original table to a global array, and then use a scripted data source to pivot the table.</p>
<p> </p>
<p>Finally, you can use Highlighting to color in the cells in the final table.</p>
Miss_Anonymus
<p>I wanted to post this, but then, my browser told me that my request failed. I tried it later and then I also saw, that it got posted anyway. So thanks for merging :-)</p>
<p> </p>
<p>But how can I <span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">set the value/highlighting color accordingly? Didn't found the property in my eclipse editor :-( And how can I do that with an Script?</span></p>
<p> </p>
<p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">Thanks for your help!</span></p>
Clement Wong
<p>Highlighting is available by first selecting your report item or cell. Then, go to <em>Layout > Property Editor > Highlights</em>. See attached screenshot:</p>
<p> </p>
<p>
Miss_Anonymus
<p>thank you very much for your detailed instruction... it works fine!</p>