Link to home
Start Free TrialLog in
Avatar of melli111
melli111Flag for United States of America

asked on

Visual Studio reporting expression

I have the following expression in a report in Visual Studio Reporting for the Filter expression of a Group:

=Fields!field1.Value < CInt(2007)

The reason for the CInt() is that the field "field1" is of type Int64 and the Expression sees "2007" as a String value.  So I use CInt() to convert the value "2007" into a Integer so the types match.  However, when running the report, I receive the error

"An error occurred during local report processing.

An error has occurred during report processing.

The processing of FilterExpression for the table ‘table1’ cannot be performed. Cannot compare data of types System.Int64 and System.String. Please check the data type returned by the FilterExpression."

I am very frustrated by this error.  I converted the String type "2007" to an Integer value, yet it is still seeing "2007" as a String value
Avatar of gamarrojgq
gamarrojgq

Hi,

Try using Int64.Parse Method

=Fields!field1.Value < Int64.Parse(2007)

But are you sure that Field1 data type is Int64?
Avatar of melli111

ASKER

Same exact error when I do that.  I do not see how the expression on the right side, 2007, is still a string type.  Very frustrating.  CInt() is teh conversion method I saw when using the Expression Builder.
Okay I figured out part of it.  The error stems from the fact that the Expression sees anything just as is as a String.  For example, "Year" and "2007" are both seen as a string.  "=2007" is seen as a NUMBER.  So that solves the conversion error.  However, the expression is still not filtering out to only everything before 2007.  It pulls ALL of the data
ok, so now how your code looks?  something like this?

=Fields!field1.Value <= 2007
I have attached a screenshot of the expression I am using.  It still does not pull the correct values.
ReportingExpression.jpg
My apologies.  The previous screen shot was the old one.  Here is what I am currently using
correctreportingexpression.jpg
ASKER CERTIFIED SOLUTION
Avatar of gamarrojgq
gamarrojgq

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial