Clarification about ReportVariable.Value and ReportVariable.ValueObject

Stimulsoft Reports.NET discussion
Post Reply
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Clarification about ReportVariable.Value and ReportVariable.ValueObject

Post by Fabio Pagano »

In 2008.2.247.0 version (of 3 June 2008) i used to set the "ValueObject" property for all reportvariables types. Example, if the reportvariable was a string i set MyReportVariable.ValueObject="MyString" and it worked.

Now in 2008.3.311.0 (of 19 November 2008) if i do the same thing the reportvariable result is "", i must use the "value" property instead of "valueobject".

This is an example:

Code: Select all

Dim v As New Stimulsoft.Report.Dictionary.StiVariable("MyStringReportVariable", System.Type.GetType("System.String"))

v.ValueObject = "MyStringValueObject"
System.Windows.Forms.MessageBox.Show(String.Concat("The value is empty for both properties: ValueObject=", v.ValueObject, " Value=", v.Value))

v.Value = "MyStringValue"
System.Windows.Forms.MessageBox.Show(String.Concat("The value is correct for both properties: ValueObject=", v.ValueObject, " Value=", v.Value))
I know that this may have sense (the "valueobject" property must be used for object types such as image or datetime, while "value" property must be used for primitives such as Integer, Long), but at now i'm a little confused (in previous version assigning a string to valueobject worked).

Could you please explain what is the correct way to set a report variable value in 2008.3 version? In which case must i use "value" property and in which case must i use "valueobject" property?

And why, in the string example above, when i set the "value" property, the "valueobject" property is automatically assigned too?

-- added

I've noticed now that "value" property is string, so i assume that "value" must be used to assign string values, while "valueobject" for all the other types. Actually valueobject doesn't work for certain types such as "Integer", so the only way to assign a value seems to use the "value" property transforming the value in string.

Thank you.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Clarification about ReportVariable.Value and ReportVariable.ValueObject

Post by Edward »

Hi, Fabio.

Yes you are right.

'Value' property has a string type and a 'ValueObject' property has an 'object' type. In any case both these properties are working together and must receive the same value.

Values of string type you can assign directly to Value property. If the type of the value is not a string, then the ValueObject property must be assigned. After assigning
of the 'ValueObject' property. After assigning of 'ValueObject' property Type property will be assigned as well and it will indicate the type of the assigned value.

Please send an example which did not work to support[at]stimulsoft.com for analysis.

Thank you.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Clarification about ReportVariable.Value and ReportVariable.ValueObject

Post by Vital »

Hello Fabio,
Fabio wrote:In 2008.2.247.0 version (of 3 June 2008) i used to set the "ValueObject" property for all reportvariables types. Example, if the reportvariable was a string i set MyReportVariable.ValueObject="MyString" and it worked.

Now in 2008.3.311.0 (of 19 November 2008) if i do the same thing the reportvariable result is "", i must use the "value" property instead of "valueobject".
Problem fixed. Patch will be available in build from 8 Dec.

Thank you.
Post Reply