Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Cascading parameter default value problem(BirtDateTime.year(BirtDateTime.now()) type mismatch)
Cascading parameter default value problem [message #636844] Wed, 03 November 2010 05:24 Go to next message
Yuri  is currently offline Yuri Friend
Messages: 5
Registered: October 2010
Junior Member
I am trying to create a cascading parameter group and set e default value for a parameter type integer from BirtDateTime.year(BirtDateTime.now()).
This function returns integer, but I am getting a data type mismatch.
Unfortunately I cannot attach a screen shot at this time.
Re: Cascading parameter default value problem [message #636997 is a reply to message #636844] Wed, 03 November 2010 16:58 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you post the report and version you are using? Your syntax works on
my report. You could also try:
parseInt(BirtDateTime.year(BirtDateTime.now()));

Jason

On 11/3/2010 1:24 AM, Yuri wrote:
> I am trying to create a cascading parameter group and set e default
> value for a parameter type integer from
> BirtDateTime.year(BirtDateTime.now()).
> This function returns integer, but I am getting a data type mismatch.
> Unfortunately I cannot attach a screen shot at this time.
Re: Cascading parameter default value problem [message #636998 is a reply to message #636844] Wed, 03 November 2010 17:04 Go to previous messageGo to next message
Yuri  is currently offline Yuri Friend
Messages: 5
Registered: October 2010
Junior Member
How can I post the report if I cannot attach files to my message?
Re: Cascading parameter default value problem [message #637011 is a reply to message #636998] Wed, 03 November 2010 18:23 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Try selecting the xml view and cut and paste the xml into the message or
just email it to me at jasonweathersby at windstream dot net.

Jason

On 11/3/2010 1:04 PM, Yuri wrote:
> How can I post the report if I cannot attach files to my message?
Re: Cascading parameter default value problem [message #637211 is a reply to message #636844] Thu, 04 November 2010 15:38 Go to previous messageGo to next message
Yuri  is currently offline Yuri Friend
Messages: 5
Registered: October 2010
Junior Member
Here is the project code.
Try to change the default value of the parameter Year to
BirtDateTime.year(BirtDateTime.now()).

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.22" id="1">
    <property name="createdBy">Eclipse BIRT Designer Version 2.6.1.v20100902 Build &lt;2.6.1.v20100915-1750></property>
    <property name="units">in</property>
    <property name="iconFile">/templates/blank_report.gif</property>
    <property name="bidiLayoutOrientation">ltr</property>
    <property name="imageDPI">96</property>
    <parameters>
        <cascading-parameter-group name="Start" id="618">
            <property name="dataSet">year</property>
            <property name="dataSetMode">single</property>
            <parameters>
                <scalar-parameter name="Year" id="619">
                    <property name="valueType">dynamic</property>
                    <property name="isRequired">true</property>
                    <property name="dataSetName">year</property>
                    <expression name="valueExpr">row["year"]</expression>
                    <property name="dataType">integer</property>
                    <property name="controlType">list-box</property>
                    <property name="fixedOrder">true</property>
                    <structure name="format"/>
                </scalar-parameter>
            </parameters>
        </cascading-parameter-group>
    </parameters>
    <data-sources>
        <script-data-source name="Script" id="562">
            <method name="beforeOpen"><![CDATA[1;]]></method>
            <method name="beforeClose"><![CDATA[1;]]></method>
            <method name="afterOpen"><![CDATA[1;]]></method>
            <method name="afterClose"><![CDATA[1;
]]></method>
            <method name="close"><![CDATA[1;]]></method>
        </script-data-source>
    </data-sources>
    <data-sets>
        <script-data-set name="year" id="613">
            <list-property name="resultSetHints">
                <structure>
                    <property name="position">0</property>
                    <property name="name">year</property>
                    <property name="dataType">integer</property>
                </structure>
            </list-property>
            <list-property name="columnHints">
                <structure>
                    <property name="columnName">year</property>
                </structure>
            </list-property>
            <structure name="cachedMetaData">
                <list-property name="resultSet">
                    <structure>
                        <property name="position">1</property>
                        <property name="name">year</property>
                        <property name="dataType">integer</property>
                    </structure>
                </list-property>
            </structure>
            <property name="dataSource">Script</property>
            <method name="open"><![CDATA[flag=0;]]></method>
            <method name="fetch"><![CDATA[if (!flag) {
	row["year"] = 2001;
	flag = 1;
	return truel
}]]></method>
        </script-data-set>
    </data-sets>
    <styles>
        <style name="report" id="4">
            <property name="fontFamily">sans-serif</property>
            <property name="fontSize">10pt</property>
        </style>
        <style name="crosstab-cell" id="5">
            <property name="borderBottomColor">#CCCCCC</property>
            <property name="borderBottomStyle">solid</property>
            <property name="borderBottomWidth">1pt</property>
            <property name="borderLeftColor">#CCCCCC</property>
            <property name="borderLeftStyle">solid</property>
            <property name="borderLeftWidth">1pt</property>
            <property name="borderRightColor">#CCCCCC</property>
            <property name="borderRightStyle">solid</property>
            <property name="borderRightWidth">1pt</property>
            <property name="borderTopColor">#CCCCCC</property>
            <property name="borderTopStyle">solid</property>
            <property name="borderTopWidth">1pt</property>
        </style>
        <style name="crosstab" id="6">
            <property name="borderBottomColor">#CCCCCC</property>
            <property name="borderBottomStyle">solid</property>
            <property name="borderBottomWidth">1pt</property>
            <property name="borderLeftColor">#CCCCCC</property>
            <property name="borderLeftStyle">solid</property>
            <property name="borderLeftWidth">1pt</property>
            <property name="borderRightColor">#CCCCCC</property>
            <property name="borderRightStyle">solid</property>
            <property name="borderRightWidth">1pt</property>
            <property name="borderTopColor">#CCCCCC</property>
            <property name="borderTopStyle">solid</property>
            <property name="borderTopWidth">1pt</property>
        </style>
    </styles>
    <page-setup>
        <simple-master-page name="Simple MasterPage" id="2">
            <page-footer>
                <text id="3">
                    <property name="contentType">html</property>
                    <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
                </text>
            </page-footer>
        </simple-master-page>
    </page-setup>
    <body>
        <text id="599"/>
        <text-data id="600">
            <expression name="valueExpr">"Start = " + params["Year"].value + " " + params["Month"].value</expression>
            <property name="contentType">html</property>
        </text-data>
    </body>
    <property name="pageVariables">
        <variable-element name="CurrentYear">
            <expression name="value" type="javascript">parseInt(BirtDateTime.year(BirtDateTime.now())).toFixed(0)</expression>
            <property name="type">report</property>
        </variable-element>
        <variable-element name="mList">
            <expression name="value" type="javascript">["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];</expression>
            <property name="type">report</property>
        </variable-element>
    </property>
</report>

Re: Cascading parameter default value problem [message #637241 is a reply to message #637211] Thu, 04 November 2010 17:02 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

This appears to be a bug. Can you log it? As a work around use a
getDefaultValueList script on the parameter. And enter the following script:
importPackage( Packages.java.util );
cal = Calendar.getInstance();
tyear = cal.get(Calendar.YEAR);
tyear;

See attached modified example

Jason

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.22"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.6.1.v20100902 Build &lt;2.6.1.v20100915-1750></property>
<property name="units">in</property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<property name="imageDPI">96</property>
<parameters>
<cascading-parameter-group name="Start" id="618">
<property name="dataSet">year</property>
<property name="dataSetMode">single</property>
<parameters>
<scalar-parameter name="Year" id="619">
<property name="valueType">dynamic</property>
<property name="isRequired">true</property>
<property name="dataSetName">year</property>
<expression name="valueExpr">row["year"]</expression>
<expression name="labelExpr">row["year"]</expression>
<property name="dataType">integer</property>
<property name="controlType">list-box</property>
<property name="fixedOrder">true</property>
<method
name="getDefaultValueList"><![CDATA[importPackage( Packages.java.util );
cal = Calendar.getInstance();
tyear = cal.get(Calendar.YEAR);
tyear;]]></method>
<structure name="format">
<property name="category">Unformatted</property>
</structure>
</scalar-parameter>
</parameters>
</cascading-parameter-group>
</parameters>
<data-sources>
<script-data-source name="Script" id="562">
<method name="beforeOpen"><![CDATA[1;]]></method>
<method name="beforeClose"><![CDATA[1;]]></method>
<method name="afterOpen"><![CDATA[1;]]></method>
<method name="afterClose"><![CDATA[1;
]]></method>
<method name="close"><![CDATA[1;]]></method>
</script-data-source>
</data-sources>
<data-sets>
<script-data-set name="year" id="613">
<list-property name="resultSetHints">
<structure>
<property name="position">0</property>
<property name="name">year</property>
<property name="dataType">integer</property>
</structure>
</list-property>
<list-property name="columnHints">
<structure>
<property name="columnName">year</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">year</property>
<property name="dataType">integer</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Script</property>
<method name="open"><![CDATA[flag=false;]]></method>
<method name="fetch"><![CDATA[if (!flag) {
row["year"] = 2001;
flag = true;
return true
}else{
return false;
}]]></method>
</script-data-set>
</data-sets>
<styles>
<style name="report" id="4">
<property name="fontFamily">sans-serif</property>
<property name="fontSize">10pt</property>
</style>
<style name="crosstab-cell" id="5">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="crosstab" id="6">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
</styles>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<data id="620">
<structure name="numberFormat">
<property name="category">Custom</property>
<property name="pattern">#0</property>
</structure>
<list-property name="boundDataColumns">
<structure>
<property name="name">Year</property>
<expression name="expression"
type="javascript">params["Year"]</expression>
<property name="dataType">string</property>
</structure>
</list-property>
<property name="resultSetColumn">Year</property>
</data>
</body>
<property name="pageVariables">
<variable-element name="CurrentYear">
<expression name="value"
type="javascript">parseInt(BirtDateTime.year(BirtDateTime.now())).toFixed(0) </expression>
<property name="type">report</property>
</variable-element>
<variable-element name="mList">
<expression name="value" type="javascript">["Jan", "Feb",
"Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
"Dec"];</expression>
<property name="type">report</property>
</variable-element>
</property>
</report>


On 11/4/2010 11:38 AM, Yuri wrote:
> Here is the project code.
> Try to change the default value of the parameter Year to
> BirtDateTime.year(BirtDateTime.now()).
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.22"
> id="1">
> <property name="createdBy">Eclipse BIRT Designer Version 2.6.1.v20100902
> Build <2.6.1.v20100915-1750></property>
> <property name="units">in</property>
> <property name="iconFile">/templates/blank_report.gif</property>
> <property name="bidiLayoutOrientation">ltr</property>
> <property name="imageDPI">96</property>
> <parameters>
> <cascading-parameter-group name="Start" id="618">
> <property name="dataSet">year</property>
> <property name="dataSetMode">single</property>
> <parameters>
> <scalar-parameter name="Year" id="619">
> <property name="valueType">dynamic</property>
> <property name="isRequired">true</property>
> <property name="dataSetName">year</property>
> <expression name="valueExpr">row["year"]</expression>
> <property name="dataType">integer</property>
> <property name="controlType">list-box</property>
> <property name="fixedOrder">true</property>
> <structure name="format"/>
> </scalar-parameter>
> </parameters>
> </cascading-parameter-group>
> </parameters>
> <data-sources>
> <script-data-source name="Script" id="562">
> <method name="beforeOpen"><![CDATA[1;]]></method>
> <method name="beforeClose"><![CDATA[1;]]></method>
> <method name="afterOpen"><![CDATA[1;]]></method>
> <method name="afterClose"><![CDATA[1;
> ]]></method>
> <method name="close"><![CDATA[1;]]></method>
> </script-data-source>
> </data-sources>
> <data-sets>
> <script-data-set name="year" id="613">
> <list-property name="resultSetHints">
> <structure>
> <property name="position">0</property>
> <property name="name">year</property>
> <property name="dataType">integer</property>
> </structure>
> </list-property>
> <list-property name="columnHints">
> <structure>
> <property name="columnName">year</property>
> </structure>
> </list-property>
> <structure name="cachedMetaData">
> <list-property name="resultSet">
> <structure>
> <property name="position">1</property>
> <property name="name">year</property>
> <property name="dataType">integer</property>
> </structure>
> </list-property>
> </structure>
> <property name="dataSource">Script</property>
> <method name="open"><![CDATA[flag=0;]]></method>
> <method name="fetch"><![CDATA[if (!flag) {
> row["year"] = 2001;
> flag = 1;
> return truel
> }]]></method>
> </script-data-set>
> </data-sets>
> <styles>
> <style name="report" id="4">
> <property name="fontFamily">sans-serif</property>
> <property name="fontSize">10pt</property>
> </style>
> <style name="crosstab-cell" id="5">
> <property name="borderBottomColor">#CCCCCC</property>
> <property name="borderBottomStyle">solid</property>
> <property name="borderBottomWidth">1pt</property>
> <property name="borderLeftColor">#CCCCCC</property>
> <property name="borderLeftStyle">solid</property>
> <property name="borderLeftWidth">1pt</property>
> <property name="borderRightColor">#CCCCCC</property>
> <property name="borderRightStyle">solid</property>
> <property name="borderRightWidth">1pt</property>
> <property name="borderTopColor">#CCCCCC</property>
> <property name="borderTopStyle">solid</property>
> <property name="borderTopWidth">1pt</property>
> </style>
> <style name="crosstab" id="6">
> <property name="borderBottomColor">#CCCCCC</property>
> <property name="borderBottomStyle">solid</property>
> <property name="borderBottomWidth">1pt</property>
> <property name="borderLeftColor">#CCCCCC</property>
> <property name="borderLeftStyle">solid</property>
> <property name="borderLeftWidth">1pt</property>
> <property name="borderRightColor">#CCCCCC</property>
> <property name="borderRightStyle">solid</property>
> <property name="borderRightWidth">1pt</property>
> <property name="borderTopColor">#CCCCCC</property>
> <property name="borderTopStyle">solid</property>
> <property name="borderTopWidth">1pt</property>
> </style>
> </styles>
> <page-setup>
> <simple-master-page name="Simple MasterPage" id="2">
> <page-footer>
> <text id="3">
> <property name="contentType">html</property>
> <text-property name="content"><![CDATA[<value-of>new
> Date()</value-of>]]></text-property>
> </text>
> </page-footer>
> </simple-master-page>
> </page-setup>
> <body>
> <text id="599"/>
> <text-data id="600">
> <expression name="valueExpr">"Start = " + params["Year"].value + " " +
> params["Month"].value</expression>
> <property name="contentType">html</property>
> </text-data>
> </body>
> <property name="pageVariables">
> <variable-element name="CurrentYear">
> <expression name="value"
> type="javascript">parseInt(BirtDateTime.year(BirtDateTime.now())).toFixed(0) </expression>
>
> <property name="type">report</property>
> </variable-element>
> <variable-element name="mList">
> <expression name="value" type="javascript">["Jan", "Feb", "Mar", "Apr",
> "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];</expression>
> <property name="type">report</property>
> </variable-element>
> </property>
> </report>
>
>
Re: Cascading parameter default value problem [message #638052 is a reply to message #637211] Tue, 09 November 2010 18:42 Go to previous messageGo to next message
Yuri  is currently offline Yuri Friend
Messages: 5
Registered: October 2010
Junior Member
I've never logged a bug here. How do I do it?
Re: Cascading parameter default value problem [message #638063 is a reply to message #638052] Tue, 09 November 2010 19:45 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Yuri,

Take a look at the bugzilla entry on this page:
http://www.eclipse.org/birt/phoenix/community.php

Jason

On 11/9/2010 1:42 PM, Yuri wrote:
> I've never logged a bug here. How do I do it?
Previous Topic:Retrieve Column Index
Next Topic:Paperclips: The import net cannot be resolved
Goto Forum:
  


Current Time: Fri Nov 21 12:23:19 GMT 2014

Powered by FUDForum. Page generated in 0.02774 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software