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)
Holiday Problem
Ulf
Hey all,
I've got a problem:
I want to show the rest of my remaining days of holiday in a table.
The base is a select statement which gave me the number of remaining days of holiday at the end of the last month and a procedure which delivers the date and the days of holidays I had for each month from last month till the month I'll have my last holiday.
Example(actual month = Febuary):
select: 31 (days)
procedure:
2011-01-01 1 (day/s holiday)
2011-02-01 1 (day/s holiday)
2011-03-01 0 (day/s holiday)
2011-04-01 4 (day/s holiday)
Now I want to show that I had
32 days remaining at the end of December (31 days from select + 1 taken in January),
31 days at the end of January (just the 30 of the select statement),
30 days at the end of Febuary and March (30 days - days taken till end of Febuary/March) and
26 days at the end of April (30 days - days taken till end of April).
The Problem is that I don't know how to subtract all the taken days of holiday from the number of days from the select statement. Actually I just subtract the taken days of the month in the same line of the table.
There where 2 attachments: the first shows the table how it should look like and the second one is the actual preview of my BIRT report...
Does anyone have anymore ideas what to do?
Regards,
Ulf
Find more posts tagged with
Comments
CBR
You can use Rhino to do the calculation.
Just add a dynamic text:
if(holiday==null) {
holiday= ... //replace with initial value
}
holiday = holiday-daysYouTookThisMonth;
//daysYouTookThisMonth are the holidays in this row...use corresponding table column binding
holiday //-- do not forget this line...it outputs value
Ulf
Thanks for answering that fast!<br />
I think that's exactly what I need, but I doesn't have any experience with JavaScript and when I add the dynamic text and look at the preview, this error message was returned:<br />
<br />
<em class='bbc'><br />
The following items have errors: <br />
<br />
<br />
ReportDesign (id = 1): <br />
+ There are errors evaluating script "if(holiday==null) {<br />
holiday=params["urlbstandaktuell"].value<br />
}<br />
holiday = holiday-row["r_anz_urlb_tage"];<br />
holiday":<br />
ReferenceError: "holiday" is not defined. (<inline>#1) <br />
</em><br />
<br />
How do I have to change the Code to make it work?
CBR
The code itself looks ok.
I forgot the fact that you have to initialize your variable before using it. Do you know about BIRT Event Handler?
The best is to initialize variables using the initialize event on report level.
Therefore click on a blank region of your report. the Properties tab should show the properties of the report itself.
then click on the script tab of the layout editor. You should then see a blank page with a select box at top. Select entry "initialize" of checkbox.
In editor region type:
holiday = null;
That's it.
CBR
instead of initializing it with a null value you can directly initialize it with params["urlbstandaktuell"].value.
You can then remove the if statement in the javascript code
But try first option before initializing it with params["urlbstandaktuell"].value
Ulf
Okay, now it works very fine.
Thank you very much!!! :-)