BIRT Exchange Forum: Merge Scripted DataSets OutputParams - BIRT Exchange Forum

Jump to content


 

BIRT Poll: To best make a table fill a pdf page before breaking (PL=page layout, PBI=page break interval) set:

PL: auto, PBI: 0PL: fixed, PBI: 0PL: auto, PBI: 1000000PL: fixed, PBI: 1000000
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Merge Scripted DataSets OutputParams Rate Topic: -----

#1 User is offline   elch Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 20-December 11


Posted 24 April 2012 - 05:18 AM

Hello everyone.

I ran into a problem with the BIRT 3.7.2 Report Designer.

I have two scripted DataSets, both consisting only of Output Parameters.
The report should use both DataSets together in one Text ReportElement that uses all of the Output Parameters in both DataSets.

To accomplish this, I created a dummy column in each of the two DataSets and joined them together on it to form a JointDataSet.
So far, so good. (Would be nice to remove the dummy column though.)

Now to the problem.
If I bind the newly created JointDataSet to the Text element and let the Designer create bindings for the output parameters, the BIRT Preview displays an Error:

Quote

+ A BIRT exception occurred. See next exception for more information.
Error evaluating Javascript expression. Script engine error: Failed to evaluate output parameter value: DS2::out2.


If i omit the bindings for the output parameters, everything works fine.
( Except that I wanted the output parameters, not the dummy join columns. :) )

If this is a new bug, could you please track it?

A workaround would be to just create a new Dataset and copy-paste the outputParams from both Datasets, but this is kind of ugly.

Am I doing anything wrong?


This is the rptdesign (Upload failed for some reason):

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1">
    <property name="createdBy">Eclipse BIRT Designer Version 3.7.2.v20120213 Build &lt;3.7.2.v20120214-1408></property>
    <property name="units">in</property>
    <property name="iconFile">/templates/blank_report.gif</property>
    <property name="bidiLayoutOrientation">ltr</property>
    <property name="imageDPI">96</property>
    <data-sources>
        <script-data-source name="ScriptedSource" id="7"/>
    </data-sources>
    <data-sets>
        <script-data-set name="DS1" id="8">
            <list-property name="resultSetHints">
                <structure>
                    <property name="position">1</property>
                    <property name="name">joincol</property>
                    <property name="dataType">integer</property>
                </structure>
            </list-property>
            <list-property name="columnHints">
                <structure>
                    <property name="columnName">joincol</property>
                </structure>
            </list-property>
            <list-property name="parameters">
                <structure>
                    <property name="name">out1</property>
                    <property name="dataType">string</property>
                    <property name="position">1</property>
                    <property name="isInput">false</property>
                    <property name="isOutput">true</property>
                </structure>
            </list-property>
            <structure name="cachedMetaData">
                <list-property name="resultSet">
                    <structure>
                        <property name="position">1</property>
                        <property name="name">joincol</property>
                        <property name="dataType">integer</property>
                    </structure>
                </list-property>
            </structure>
            <property name="dataSource">ScriptedSource</property>
            <method name="open"><![CDATA[
outputParams["out1"] = "This is out1.";

printJoinCol = true;
]]></method>
            <method name="fetch"><![CDATA[if(printJoinCol){
	row["joincol"] = 1;
	printJoinCol = false;
	return true;
}
return false;]]></method>
        </script-data-set>
        <script-data-set name="DS2" id="9">
            <list-property name="resultSetHints">
                <structure>
                    <property name="position">1</property>
                    <property name="name">joincol</property>
                    <property name="dataType">integer</property>
                </structure>
            </list-property>
            <list-property name="columnHints">
                <structure>
                    <property name="columnName">joincol</property>
                </structure>
            </list-property>
            <list-property name="parameters">
                <structure>
                    <property name="name">out2</property>
                    <property name="dataType">string</property>
                    <property name="position">1</property>
                    <property name="isInput">false</property>
                    <property name="isOutput">true</property>
                </structure>
            </list-property>
            <structure name="cachedMetaData">
                <list-property name="resultSet">
                    <structure>
                        <property name="position">1</property>
                        <property name="name">joincol</property>
                        <property name="dataType">integer</property>
                    </structure>
                </list-property>
            </structure>
            <property name="dataSource">ScriptedSource</property>
            <method name="open"><![CDATA[
outputParams["out2"] = "This is out2.";

printJoinCol = true;]]></method>
            <method name="fetch"><![CDATA[if(printJoinCol){
	row["joincol"] = 1;
	printJoinCol = false;
	return true;
}
return false;]]></method>
        </script-data-set>
        <joint-data-set name="JointSet" id="17">
            <list-property name="columnHints">
                <structure>
                    <property name="columnName">DS1::joincol</property>
                    <property name="alias">DS1::joincol</property>
                    <property name="analysis">measure</property>
                    <text-property name="displayName">DS1::joincol</text-property>
                </structure>
                <structure>
                    <property name="columnName">DS2::joincol</property>
                    <property name="alias">DS2::joincol</property>
                    <property name="analysis">measure</property>
                    <text-property name="displayName">DS2::joincol</text-property>
                </structure>
            </list-property>
            <list-property name="parameters">
                <structure>
                    <property name="name">DS2::out2</property>
                    <property name="dataType">string</property>
                    <property name="position">1</property>
                    <property name="isOptional">false</property>
                    <property name="allowNull">false</property>
                    <property name="isInput">false</property>
                    <property name="isOutput">true</property>
                </structure>
                <structure>
                    <property name="name">DS1::out1</property>
                    <property name="dataType">string</property>
                    <property name="position">2</property>
                    <property name="isOptional">false</property>
                    <property name="allowNull">false</property>
                    <property name="isInput">false</property>
                    <property name="isOutput">true</property>
                </structure>
            </list-property>
            <structure name="cachedMetaData">
                <list-property name="resultSet">
                    <structure>
                        <property name="position">1</property>
                        <property name="name">DS1::joincol</property>
                        <property name="dataType">integer</property>
                    </structure>
                    <structure>
                        <property name="position">2</property>
                        <property name="name">DS2::joincol</property>
                        <property name="dataType">integer</property>
                    </structure>
                </list-property>
            </structure>
            <simple-property-list name="dataSets">
                <value>DS1</value>
                <value>DS2</value>
            </simple-property-list>
            <list-property name="joinConditions">
                <structure>
                    <property name="joinType">inner</property>
                    <property name="joinOperator">eq</property>
                    <property name="leftDataSet">DS1</property>
                    <property name="rightDataSet">DS2</property>
                    <expression name="leftExpression">dataSetRow["joincol"]</expression>
                    <expression name="rightExpression">dataSetRow["joincol"]</expression>
                </structure>
            </list-property>
        </joint-data-set>
    </data-sets>
    <page-setup>
        <simple-master-page name="Simple MasterPage" id="2"/>
    </page-setup>
    <body>
        <label id="11">
            <property name="fontWeight">bold</property>
            <text-property name="text">Only DS1:</text-property>
        </label>
        <text id="10">
            <property name="dataSet">DS1</property>
            <list-property name="boundDataColumns">
                <structure>
                    <property name="name">joincol</property>
                    <text-property name="displayName">joincol</text-property>
                    <expression name="expression" type="javascript">dataSetRow["joincol"]</expression>
                    <property name="dataType">integer</property>
                </structure>
                <structure>
                    <property name="name">out1</property>
                    <expression name="expression" type="javascript">outputParams["out1"]</expression>
                    <property name="dataType">string</property>
                </structure>
            </list-property>
            <property name="contentType">html</property>
            <text-property name="content"><![CDATA[joincol: <VALUE-OF>row["joincol"]</VALUE-OF><BR>
out1: <VALUE-OF>row["out1"]</VALUE-OF>]]></text-property>
        </text>
        <label id="12">
            <property name="fontWeight">bold</property>
            <text-property name="text">Only DS2:</text-property>
        </label>
        <text id="13">
            <property name="dataSet">DS2</property>
            <list-property name="boundDataColumns">
                <structure>
                    <property name="name">joincol</property>
                    <text-property name="displayName">joincol</text-property>
                    <expression name="expression" type="javascript">dataSetRow["joincol"]</expression>
                    <property name="dataType">integer</property>
                </structure>
                <structure>
                    <property name="name">out2</property>
                    <expression name="expression" type="javascript">outputParams["out2"]</expression>
                    <property name="dataType">string</property>
                </structure>
            </list-property>
            <property name="contentType">html</property>
            <text-property name="content"><![CDATA[joincol: <VALUE-OF>row["joincol"]</VALUE-OF><BR>
out2: <VALUE-OF>row["out2"]</VALUE-OF>]]></text-property>
        </text>
        <label id="15">
            <property name="fontWeight">bold</property>
            <text-property name="text">JointSet without output params binding:</text-property>
        </label>
        <text id="16">
            <property name="dataSet">JointSet</property>
            <list-property name="boundDataColumns">
                <structure>
                    <property name="name">DS1::joincol</property>
                    <text-property name="displayName">DS1::joincol</text-property>
                    <expression name="expression" type="javascript">dataSetRow["DS1::joincol"]</expression>
                    <property name="dataType">integer</property>
                </structure>
                <structure>
                    <property name="name">DS2::joincol</property>
                    <text-property name="displayName">DS2::joincol</text-property>
                    <expression name="expression" type="javascript">dataSetRow["DS2::joincol"]</expression>
                    <property name="dataType">integer</property>
                </structure>
            </list-property>
            <property name="contentType">html</property>
            <text-property name="content"><![CDATA[<I>DS1:</I><BR>
joincol: <VALUE-OF>row["DS1::joincol"]</VALUE-OF><BR>
<I>DS2:</I><BR>
joincol: <VALUE-OF>row["DS2::joincol"]</VALUE-OF>]]></text-property>
        </text>
        <label id="18">
            <property name="fontWeight">bold</property>
            <text-property name="text">JointSet with output params binding (Error, see Preview):</text-property>
        </label>
        <text id="19">
            <property name="dataSet">JointSet</property>
            <list-property name="boundDataColumns">
                <structure>
                    <property name="name">DS1::joincol</property>
                    <text-property name="displayName">DS1::joincol</text-property>
                    <expression name="expression" type="javascript">dataSetRow["DS1::joincol"]</expression>
                    <property name="dataType">integer</property>
                </structure>
                <structure>
                    <property name="name">DS2::joincol</property>
                    <text-property name="displayName">DS2::joincol</text-property>
                    <expression name="expression" type="javascript">dataSetRow["DS2::joincol"]</expression>
                    <property name="dataType">integer</property>
                </structure>
                <structure>
                    <property name="name">DS2::out2</property>
                    <expression name="expression" type="javascript">outputParams["DS2::out2"]</expression>
                    <property name="dataType">string</property>
                </structure>
                <structure>
                    <property name="name">DS1::out1</property>
                    <expression name="expression" type="javascript">outputParams["DS1::out1"]</expression>
                    <property name="dataType">string</property>
                </structure>
            </list-property>
            <property name="contentType">html</property>
            <text-property name="content"><![CDATA[<I>DS1:</I><BR>
joincol: <VALUE-OF>row["DS1::joincol"]</VALUE-OF><BR>
out1: <VALUE-OF>row["DS1::out1"]</VALUE-OF><BR>
<I>DS2:</I><BR>
joincol: <VALUE-OF>row["DS2::joincol"]</VALUE-OF><BR>
out2: <VALUE-OF>row["DS2::out2"]</VALUE-OF>]]></text-property>
        </text>
    </body>
</report>

0

#2 User is offline   mwilliams Icon

  • BIRT Guru
  • Icon
  • View blog
  • Group: Administrators
  • Posts: 12937
  • Joined: 16-May 08


Posted 24 April 2012 - 02:32 PM

This appears to be a bug. Please log it in the Eclipse.org bugzilla. If you could include the bug info in here, for future reference, that'd be great! Thanks!
Regards,

Michael

Twitter
Facebook
Blog
Yahoo: mwilliams_actuate@yahoo.com
Google: mwilliams.actuate@gmail.com
0

#3 User is offline   elch Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 20-December 11


Posted 25 April 2012 - 02:31 PM

I filed the bug at bugzilla: Bug 377711

The file causing the error is attached there.

I guess copying the javascript-code that generates the output parameters in both sets into a new dataset is good enough for now.
Maybe putting all the javascript into the initialize() method of the report is another, less ugly workaround.

Anyways, thanks for you time, it's very much appreciated.
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users