Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
how can I get the day' name of today on a chart title in birt
Alec
Hi all,
Can anybody help me in getting the day's name on a chart title in birt.
Like I need to have in the title: "Network generators on Monday"...
the data of the report changes everyday so It would be great to have the day's name in the title.
Thank you!
Find more posts tagged with
Comments
Alec
Hi guys I am trying to set the title of a chart using the Script.
so far I got this :
function beforeGeneration( chart, icsc )
{
var ct = new date(); //if(WEEKDAY(today()) = 'Mon', 'Friday', WEEKDAY(TODAY()-1));
var title = "Top 5 networking Generators On " + ct;
chart.getTitle().getLabel().getCaption().setValue(title);
}
it is for sure not working.
What I am trying to do is to get the day of yesterday on the title.
any help?
Thanks!
mwilliams
Are you wanting the "day" of week or the "date" from yesterday? What is your BIRT version?
Alec
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="83066" data-time="1316550795" data-date="20 September 2011 - 01:33 PM"><p>
Are you wanting the "day" of week or the "date" from yesterday? What is your BIRT version?<br /></p></blockquote>
I would love to have the day of yesterday not the date.<br />
Birt Version 2.5.2
Alec
Thank you for your help!
cypherdj
Hi,
here's an example using BIRT Designer 2.5.1
have a look in the masterpage, I created a dynamic text there, and used a rhino script to invoke the java SimpleDateFormat with the day of the week pattern, and formatted today's date.
hope that helps,
Cedric
Alec
Thank you but how can I type that in the master page header.
I am now in the master page but not able to type the code!
Alec
Awesome it is workingggggg..
Do you know how do I get to yesterday's date?
Thanks!
cypherdj
just use new Date()-1.
Note that this is the full report page, rather than the chart title. I'm trying the same with the beforeGeneration method of a chart, but I'm not having any luck with it so far, it expects a Text and not a String, and I havent found which Text class it's referring to
but if i figure it out specifically for the chart, i'll let you know. In the meantime, what you could do is untick the visible checkbox of the chart title
mwilliams
Here is an example that shows how to get yesterday's day of week in the title. Hope it helps.
cypherdj
ah, nice one michael, i was calling setCaption and not getCaption().setValue()
Alec
You are the best.
Thank you for your help!