
This devshare submission qualifies for
BIRT Style Contest<br />
Hi All,<br />
<br />
This report design accepts RSS feeds from Yahoo weather portal and based on that data,picks styles dynamically.User needs to select 'Your Location' report parameter and report uses that value to form the query.This report uses XML data source to parse portal response and accepts a URL as a source location.Report uses internally two more report parameters called 'Style' and 'Forecast Style' and we determine their values from tables column bindings.This report totally has 4 columns<br />
<br />
They are<br />
<br />
1) City name<br />
<br />
2) Date of forcast publication<br />
<br />
3) Current weather info<br />
<br />
4) Forecast weather info
if(params["Style"].value == "Partly Cloudy")
{
this.getStyle().backgroundColor = "#E3E4E5";
}
else if(params["Style"].value == "Clear")
{
this.getStyle().backgroundColor = "#87CEFA";
}
else if(params["Style"].value == "Snow")
{
this.getStyle().backgroundColor = "#F0FFFF";
}
else if(params["Style"].value == "Fair")
{
this.getStyle().backgroundColor = "#FFCC33";
}
else if(params["Style"].value == "Sunny")
{
this.getStyle().backgroundColor = "#FF7F50";
}
else if(params["Style"].value == "Hot")
{
this.getStyle().backgroundColor = "#FF4F00";
}
else if(params["Style"].value == "Haze")
{
this.getStyle().backgroundColor = "#2F4F4F";
}
else
{
this.getStyle().backgroundColor = "#73C2FB";
}
<br />
this is the script whitch determines background colour of cell.Almost same script used for forecast style parameter.We can add font properties,border properties to the above script easily. Apart from this, report displays appropiate image files as per weather info.<br />
<br />
Yahoo weather gives around 47 weather conditions.Out of 47,this reports handles 5 or 6 conditions.But we can handle more conditions easily by adding 'if' conditions to above script.For example,
if(params["Style"].value == "What ever condition you want to try")
{
this.getStyle().backgroundColor = "Color hexa code";
}
(or)
var colors = new Array('#8B8989','#AEEEEE','#B0C4DE','#EEB4B4','#EEEEE0','#76EEC6','#DAF4F0','#F0F8FF',
'#E6E6FA','#F8F8FF','#ADD8E6','#FFFAFA','#FFFAFA','#CFDBC5','#FAFAD2','#FFFAF0','#737373','#FAFAFA'
,'#F5DEB3','#E0E0E0','#E0EEEE','#E0EEEE','#668B8B','#D3BECF','#F6CCDA','#E3E4E5','#CCCCFF','#CCCCFF',
'#CCCCFF','#CCCCFF','#87CEFA','#FF7F50','#BFBFBF','#FFCC33','#CDE472','#FF4F00','#0FDDAF','#0FDDAF',
'#0FDDAF','#A4D3EE','#CAE1FF','#CAE1FF','#CAE1FF','#E3E4E5','#DAF4F0','#DAF4F0','#DAF4F0');
if(params["Style"].value != 3200)
{
this.getStyle().backgroundColor = colors[params["Style"].value-1];
}
else
{
this.getStyle().backgroundColor = "#73C2FB";
}
<br />
above script covers all 47 conditions.Here we have to change 'Style' parameter type from string to integer.And binding<br />
value will be 'params["Style"].value = row["current code"]'.<br />
<br />
Uploaded sample design file with modified script to cover all possible conditions.<br />
<br />
Let me know if you require more information.<br />
<br />
Raghava