Supplying column name to the report item [message #145471] |
Fri, 17 March 2006 12:16  |
Eclipse User |
|
|
|
Originally posted by: anton.maslovsky.gmail.com
Hello,
I have a report, which needs to include 24 hour coumns. Each data item is
displayed differently using various conditions. For exmaple, I need to round
a float value when certain global flag is set (ex. row["HE1"] != null ?
(unitStatuses ? Math.round(row["HE1"].qty) : row["HE1"].qty) : null) or
highlight a cell based on some criteria (ex. (row["HE1"] != null &&
row["HE1"].attribute == "H") then set background to RED).
This can all be done easily using BIRT features, but I'd really like to
avoid doing the same same for each 24 column. What would help me is being
able to specify coumn name ("HE1" in my examples) in one place and then use
it in all the places, such as:
- Value Expression
- Visibility
- Highlights
- Scripts
Is there a way to assign some kind of a property to the report item and then
use it consystently? Or even better - calculate such value based on data
item position in the table row?
Regards,
Anton
|
|
|
|
|
Re: Supplying column name to the report item [message #145704 is a reply to message #145661] |
Fri, 17 March 2006 16:20  |
Eclipse User |
|
|
|
> Global variable does't work for me because it gets overwritten by other data
> cells (remember I have 24 columns)
> In my particular case I'd need to srore the variabe inside the report item
> and use din all the places (highlights, expression, script, etc).
If I understand correctly you need just global function with some
parameters.
And use the function for example inside onCreate method.
>> Regarding second question I don't know exactly how to do it but I suggest
>> that you take look on this:
>> http://www.eclipse.org/birt/phoenix/deploy/reportScripting.p hp
>> and aprobably it will be useful to know that row[0] define number of row
>> so probably row[1] define something else.
> row[1] defines the value of the first clumn in the data row. What I need is
> the position of the report item in in the table.
> Maybe there is a way to get the vaue of the label item in the header above?
> That would help in my particular case...
Again I don't know exactly the answer but you could take a look on this
link:
http://www.eclipse.org/birt/phoenix/ref/ROM_Scripting_SPEC.p df
section from that link:
6.4.1 Accessing Other Report Items
One can navigate from one ElementState object to another at run time. For
example,
if in a table, the header row has a data item named A, and the detail
row has two
columns named B and C, when we are on B, the following scripts are
valid:
me.fontName returns the font name property for this item
me.container returns the parent (a table row) object
me.container.C returns report item instance created with the same data
row but based on item C
me.container.container returns the detail slot
me.container.container.container returns the table object
me.container.container.container.header returns the header slot
me.container.container.container.header.C returns the item C
Navigations lead to further complications because a report item can access
and modify
not only its own properties, but also properties defined for other report
items. One such
example if for the font color of one report item (C) to depend on the
value in another
report item (B). Another example is for background color of a table to
change based on
an aggregate value displayed in the table footer (i.e., if the total sales
is less than a
threshold, change the tables background color to red). The first example
should in fact
be handled using computed columns. The second example is what leads to the
concept
of execution blocks.
-------------------------------------
But keep in mind that information outdated on this link.
For example instead of "me" you have to use "this" and instead of
"container" it seems better to use "parent". Nothing more I know. Again
keep the close look on link:
http://www.eclipse.org/birt/phoenix/deploy/reportScripting.p hp
Let me know in case you got solution.
|
|
|
Powered by
FUDForum. Page generated in 0.08406 seconds