Round of issue for BIRT parameters
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">We have BIRT 4.4.0 report with a report parameter of decimal data type.</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">The report parameter gets rounded up/down to the nearest 10 in Data Set Preview Results (and when the report is run, but we've narrowed the problem to the Data Set).</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">E.g. if the paramter is </span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">0-4, rounds down to 0</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">5-9, rounds up to 10</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">10-14 rounds down to 10</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">15-20 rounds up to 20</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">:</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">:</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">90-94 rounds down to 90</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">95-100 rounds up to 100</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">The database is SQLServer 2012. The problem has not been tested against other databases.</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">The .rptdesign is not being included, since the various tests below change it and you can use a blank report.</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">The problem is in the DataSet and you won't need to run a report, but to preview results in the DataSet.</span></span></span></p>
<p> </p>
<p><strong><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">Steps to reproduce</span></span></span></strong></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">1) Use BIRT 4.4.0 designer, Java 1.7 u25 (jdk-7u25-windows-i586.exe), SQLServer 2012</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">2) Create a database (AlbumsDB) with a table (Albums) with the following columns</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">Title varchar(50) not null</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">Cost decimal(18,0) not null</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">Type char(10) not null</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">3) Populate with the following 3 rows</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;"> Title Cost Type</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;"> APPLE 0 D</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;"> ABBEY ROAD 1 D</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;"> BEATLES 2 D</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">4) Create a blank report</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">5) Create a Datasource to the SQLServer</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">6) Create a Dataset</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">The Data Set query in BIRT is created using column selection from the table (and not typed in).</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">Please keep the format exactly as shown, using only cursor positioning and double-clicking the column/table names to select them.</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">select dbo.Albums.Title,</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">dbo.Albums.Cost,</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">dbo.Albums.type</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">from dbo.Albums</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">where dbo.Albums.Cost = ?</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">The query parameter:</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">Name: param_1</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">Native Name: greyed out and not enterable</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">Data Type: Decimal</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">Direction: Input</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">Default Value: 2</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">Linked to Report Parameter: None</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">The default parameter was set to 2, so that tests will either produce the correct Cost=2 row, or round down and produce the incorrect Cost=0 row.</span></span></span></p>
<p> </p>
<p><strong><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">Tests</span></span></span></strong></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">=====</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">1) When the SQL statement was setup in this format, </span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">- the "Preview Results' in the Data Set produced the wrong result (the rounded down Cost=0 row)</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">- the .rptdesign file did not have the nativeDataType attribute</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">2) When sql was edited and the table name was brought up to the same line as the last column selected as:</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">select dbo.Albums.Title,</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">dbo.Albums.Cost,</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">dbo.Albums.type from dbo.Albums</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">where dbo.Albums.Cost = ?</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">- the "Peview Results " in the Data Set produced the correct result (the Cost=2 row)</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">- the .rptdesign file did not have the nativeDataType attribute</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">3) When the format of the sql was</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">select dbo.Albums.Title, dbo.Albums.Cost,</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">dbo.Albums.type </span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">from dbo.Albums</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">where dbo.Albums.Cost = ?</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">or</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">select dbo.Albums.Title,.Albums.Cost,.Albums.type </span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">from dbo.Albums</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">where dbo.Albums.Cost = ?</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">that is, some or all columns selected put on same line as "select", keeping "from <table-name>" on a separate line</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">- the "Preview Results' in the Data Set produced the wrong result (the rounded down Cost=0 row)</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">- the .rptdesign file did not have the nativeDataType attribute</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">4) When the entire SQL was put on one line</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">select dbo.Albums.Title,.Albums.Cost,.Albums.type from dbo.Albums where dbo.Albums.Cost = ?</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">- the "Peview Results " in the Data Set produced the correct result (the Cost=2 row)</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">- the .rptdesign file now had the correct nativeDataType attribute <propert name="nativeDataType">3</property></span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">5) When any whitespace (spaces) was introduced in the statement:</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">select dbo.Albums.Title,</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">dbo.Albums.Cost,</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">dbo.Albums.type</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">from dbo.Albums</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">where dbo.Albums.Cost = ?</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">- the "Preview Results' in the Data Set produced the wrong result (the rounded down Cost=0 row)</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">- the .rptdesign file had an incorrect nativeDataType attribute <property name="nativeDataType">0</property></span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">In all tests above, if the SQL format was reverted, the nativeDataType attribute stayed in the .rptdesign file.</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">It got changed from "0" to "3" when the "from dbo.Albums" was brought upto the same line as "select".</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">6) Your suggestion to add the nativeDataType line to the .rptdesign had no effect, until step 6d)</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">a) Edited the initial .rptdesign (without the nativeDataType) and with the sql format as created in #1, and added <property name="nativeDataType">3</property> </span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">- the "Preview Results' in the Data Set produced the wrong result (the rounded down Cost=0 row)</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">b) Then added <property name="nativeName"></property></span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">- the "Preview Results' in the Data Set produced the wrong result (the rounded down Cost=0 row)</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">c) Then added <property name="isOptional">false</property></span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">- the "Preview Results' in the Data Set produced the wrong result (the rounded down Cost=0 row)</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:tahoma, sans-serif;"><span style="font-size:10pt;">d) When a slight change to the format of the SQL statement is made (bring the "from db.Albums" up to the line of the last column selected), CDReport.rptdesign produces the correct result.</span></span></span></p>