Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 314140

Summary: DataSetParameter.setDefaultValue Should be an Expression
Product: z_Archived Reporter: Scott Rosenbaum <scottr>
Component: BIRTAssignee: Birt-Report-inbox <Birt-Report-inbox>
Status: RESOLVED FIXED QA Contact: Liwen Chen <lchen>
Severity: normal    
Priority: P3 CC: berenice.maurel, bluesoldier, lchen, rlu
Version: 2.5.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Scott Rosenbaum CLA 2010-05-24 12:45:16 EDT
On the org.eclipse.birt.report.model.api.DataSetParameter class the setDefaultValue method does not work if the value is an expression (such as a date in the form "2005-01-01").  This is a result of 191445 which made the Default Value an expression.  

Recommend either deprecating the method (in favor of setPropertyExpression) or better change implementation to use setPropertyExpression.

This is primarily an issue for those people that are using Design API, seems to  have all ready been addressed in the Designer UI elements.
Comment 1 Rick Lu CLA 2010-05-24 21:53:29 EDT
In DataSetParameter:

	public void setDefaultValue( String expr )

If the call passes into a string,this API doesn't work?

To set the expression value, should use setExpressionProperty( ).
Comment 2 Scott Rosenbaum CLA 2010-05-24 22:23:48 EDT
Does not work if Parameter is type Date and you pass any of the following:
- 2005-01-01
- "2005-01-01"
- '2005-01-01'

It does work if you use setPropertyExpression of type JavaScript with a quote delimited date.
Comment 3 Rick Lu CLA 2010-05-26 04:58:31 EDT
(In reply to comment #2)
> Does not work if Parameter is type Date and you pass any of the following:
> - 2005-01-01
> - "2005-01-01"
> - '2005-01-01'
> 
> It does work if you use setPropertyExpression of type JavaScript with a quote
> delimited date.

If pass a string to DataSetParameterHandle.setDefaultValue(string), the string value is treated as a javascript string. This is an API compatibility.

Can you please give out details how this API doesn't work out?
Comment 4 BiM Mising name CLA 2010-07-20 08:36:47 EDT
Hi,

Have you try this ?
myParameter.setDefaultValue("\"2005-01-01\");

Regards,
BiM
Comment 5 Liwen Chen CLA 2011-08-19 05:20:56 EDT
Please set default value as ("\"2005-10-10\""), which can parse correct date default value to report.

We can not deprecate setDefaultValue since multiple existed application and samples using it.

Set Fix.

If you still have any questions, please reopen this bug.
Comment 6 Xiaoying Gu CLA 2011-08-19 05:22:17 EDT
fix