Problem with Fields in Parameter Expression
Hello I am a bloody newbe and have a question. I want to create a Parameter with two available Values.
when I write sth like this for the first value in the expression field =(Fields!Is.Value<1.5*Fields!Plan.Value) the Report Server pops out an error. What should I have to do to solve the problem. The first Parameter value should filter the report for
all "Is" where this criteria is correct.
I would be very happy if someone could help me
May 29th, 2011 3:40am
What error do you get? Did you write =IIF(Fields!Is.Value<1.5*Fields!Plan.Value,TRUE,FALSE) or something?Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
Free Windows Admin Tool Kit Click here and download it now
May 29th, 2011 3:47am
The error I got was "Fields cannot be used in parameter expressions". I tried is with and without IIF
thx for your first answer
May 29th, 2011 3:57am
Just did quick testing and it worked just fine
=iif(Fields!TotalSize_MB.Value>=3*Fields!TotalSize_MB.Value,"ok","not ok")Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
Free Windows Admin Tool Kit Click here and download it now
May 29th, 2011 4:21am
I do get this error again. Somehow it doesnt work. I wrote this expression inside a Parameter
=iif(Fields!Is.Value>=3*Fields!Plan.Value,"ok","not ok")
System.Web.Services.Protocols.SoapException: Error 1 [rsFieldInReportParameterExpression] A Value expression used for the report parameter ‘ReportParameter1’ refers to a field. Fields cannot be used in
report parameter expressions.
at Microsoft.ReportingServices.WebServer.ReportingService2005Impl.SetReportDefinition(String Report, Byte[] Definition, Warning[]& Warnings)
at Microsoft.ReportingServices.WebServer.ReportingService2010Impl.SetItemDefinition(String ItemPath, Byte[] Definition, Property[] Properties, Warning[]& Warnings)
at Microsoft.ReportingServices.WebServer.ReportingService2010.SetItemDefinition(String ItemPath, Byte[] Definition, Property[] Properties, Warning[]& Warnings)
May 29th, 2011 4:37am
what if you go by the report items.
whats the name of the "Is" and "plan" field?
you're able to use it in expression.
ie, the field name of "Is" is textbox1 and textbox2 for plan, then you're able to write the expression like
=iif(reportitems!textbox1.value * reportitems!textbox2.value, "OK", "NOT OK")AddinGanteng
Free Windows Admin Tool Kit Click here and download it now
May 29th, 2011 4:57am
their Field Names are identical to the displayed names. i am able to use it in expressions. but i dont understand why they cant be used in report parameter expressions
May 29th, 2011 5:04am
do you mean you're trying to use it as default value of the parameter?
AddinGanteng
Free Windows Admin Tool Kit Click here and download it now
May 29th, 2011 5:07am
no i am trying to use it as available value of the parameter
May 29th, 2011 5:09am
try creating new dataset for the parameter and set the value inside the query
ie.
SELECT CASE WHEN IS * PLAN < 1.5 THEN "TRUE VALUE" ELSE "FALSE VALUE" END AS YOURDESIREDFIELDNAME FROM YOURTABLENAME
then set the default value of the parameter using that datasetAddinGanteng
Free Windows Admin Tool Kit Click here and download it now
May 29th, 2011 5:10am
yes, you could do it either way.
create new dataset, query the parameter you want to show, us it on the default or available values.
when you use the fields value, it won't worked on parameters, because the field value should be ran first to get their value aren't they?
May 29th, 2011 5:20am