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
LVL 15
melli111SharePoint Administrator / DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Try using Int64.Parse Method

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

But are you sure that Field1 data type is Int64?
melli111SharePoint Administrator / DeveloperAuthor Commented:
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.
melli111SharePoint Administrator / DeveloperAuthor Commented:
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
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

ok, so now how your code looks?  something like this?

=Fields!field1.Value <= 2007
melli111SharePoint Administrator / DeveloperAuthor Commented:
I have attached a screenshot of the expression I am using.  It still does not pull the correct values.
melli111SharePoint Administrator / DeveloperAuthor Commented:
My apologies.  The previous screen shot was the old one.  Here is what I am currently using
ok try this in the EXPRESSION column put this


And in the VALUE column put this


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.