Friday, March 9, 2012

how to use equal sign (=) as an available value for a parameter?

Is there a way to use the equal sign (=) as an available value for a parameter?
It's working with the rest of the comparison operators: <>, >, >=, <, <=.

Thank you!

I'm not sure what the equal sign is going to be used as, but yes you shouldn't have a problem setting it as an available value if you make the data type a string.

Then just use this as the expression for the non-queried value: ="="

|||

Assuming the parameter is defined as a string try ="=".

One problem I have found with this type of parameter is that if it is not defined as the first parameter is it will be 'greyed out' and you will get a 'hiccup" as it tries to evalutate the formula.

|||

I want the users to be able to choose one of the comparison operators to filter a numeric field. Something like: Balance = 0 or Balance > 500.
So one of the parameters it's going to collect the comparison operator and another parameter will collect the numeric value and feed the stored procedure.

In the available values that are defining the Operator parameter I have this:
Label Value
not equal <>
greater than >
greater or equal than >=
less than <
less or equal than <=
The parameter is defined as string.

For the rest of comparison operators I don't have for example =">" but > and the report is returning the correct results.
Trying to have just = for the value column will give an error which is normal since = is used to build an expression.
But trying your solution to use ="=" it's not working.
I guess I'm missing something and I don't know exactly what.

Thank you for your reply

|||

I'm still unsure as to how you are creating a query with these parameters. However, one thing you can try is to use an if statement and check for "=". Then, if it matches perform the equal query, otherwise use the actual parameter value.

|||

It worked with ="=". My mistake...
I've changed the way the stored procedure was built.
Initially I was transfering to the stored procedure the operator and the numeric value concatenated already.
The change I've made is to use separate input parameters for the stored procedure instead of transfering them concatenated.
In this way it's working to use ="=".

I've also experienced what Lonnie remarked.
The parameter that is using ="=" needs to be the first parameter otherwise it will be disabled.
It's kind of annoying if you don't want this parameter to appear as the first one.

Thank you guys...

No comments:

Post a Comment