Changing row formatting depending on the row number... [message #69616] |
Thu, 25 August 2005 09:49  |
Eclipse User |
|
|
|
Hello.
I understand the 'conditionnal formatting' stuff, but I'm trying to
format rows in a table depending on their number instead of a value
(even rows should be gry and odd rows white, for example).
Does anyone know if there exists a birt scripting variable indicating
the row number (I was thnking of something like 'number % 2 Equal 0',
but Ican't get the row number).
I tried a condition on a boolean on the row itself, (grey = !grey
Equal True), but it seems like the condition is checked for every cell
of the row, not row per row...).
Any idea?
|
|
|
|
Re: Changing row formatting depending on the row number... [message #69758 is a reply to message #69656] |
Fri, 26 August 2005 04:06   |
Eclipse User |
|
|
|
>you should be able to set a global variable then access that variable in
>the expression on the conditional highlighting using the mod code you
>provided
Thanks for your suggestion, David, but this doesn't work as I'd like
it to. I already had tried such a thing (the boolean test and the n %
2 test are the same).
I finally figured out a workaround, but it's a little tricky (I'm not
satisfied with it, allthough it works).
This is what I would like:
----------------------------
I would like to format the entire row background depending on the row
number. I tried doing this by selecting the row in the table (layout
mode), and setting a Highlight condition (n++ % 2 Equal 0) or (c=!c
Equal true).
Why it doesn't work:
------------------------
Unfortunately, the condition is checked for each cell in the row, and
not per row. Instead of having a table with even rows grey and odd
rows white, the table has cells alternatively grey and white on the
same row...
If you check the Highlight condition on each cell, it is indeed set to
the same condition as the one entered or the row.
This is what I had to do to get it to work:
------------------------------------------------
I removed the condition on each cell but the last one in the row.
The condition on the row is now: (n % 2 Equal 0), and the condition
on the last cell of the row is (n++ % 2 Equal 0).
Why I don't like that workaround:
---------------------------------------
The inconvenient of the workaround is that, if I add another data
column to the right of my row, I have to change the formatting code on
the last column... Thing which can easily be forgotten...
And the logic isn't to format the last cell differently than the
others, the logic is to format the entire row...
My questions:
---------------
1. Is it impossible to format rows? Does this in fact format the cells
composing the row...?
2. Is it possible to know the row number?
|
|
|
|
|
|
Re: Changing row formatting depending on the row number... [message #70058 is a reply to message #69946] |
Mon, 29 August 2005 07:36  |
Eclipse User |
|
|
|
Mark and Michael, thanks for your help.
Thanks for the 'row[0]' tip to get the row number, it sure helps.
For the background formatting, the duplivcate grid seems to be quite
hacky indeed, I'll manage with a cell-formatting for the moment (and
see that the cells have the same height)...
Frédéric
On Fri, 26 Aug 2005 13:21:22 -0700, "Mark Coggins"
<mcoggins@actuate.com> wrote:
>Another way to skin the cat is to to have two rows and insert a grid into
>each row. Each grid has the full set of data you want to show. You can turn
>off and on the visibility of each grid with the visibility property. One is
>set to hide when (row[0] % 2 == 0) is true and the other is set to hide when
>(row[0] % 2 == 1) is true. The background color for one is set to gray and
>the background for the other is left alone. You don't use the highlight
>feature at all. I've attached a sample here.
>
>It's definitely a hack since you have to duplicate so much info, though ...
>
>Mark
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.15383 seconds