none
Parameter with OR condition

    Question

  • Is it possible to do the below?  As I can't work it out if so.

    For example I have a parameter (Region) which lists Manchester, Liverpool, London and then a 2nd parameter (Area) Salford, Albert Dock and Victoria. 

    If my user wants to select '' (blank region) and instead just pass Salford through how can this be done?  So it's basically 2 parameters with an OR condition, so one or the other.  I've tried coding this in SQL but it appears that for a parameter something has to be specified for each one explicitly

    thanks

    Thursday, September 27, 2012 9:36 AM

Answers

  • Thanks for your responses.

    I've managed to fix it myself by allowing parameter 1 and 2 to 'Allow blank value' and changing my SQL code to "IN (@parameter1, @parameter2)" 

    • Marked as answer by MJ2012 Thursday, September 27, 2012 11:36 AM
    Thursday, September 27, 2012 11:35 AM

All replies

  • Hi MJ,

    You can pass the null value from the parameter.While creating the parameter go to parameter properties and check Allow Null value check box so the parameter will accept the null value.


    *Regards*
    *Samay Shrivastava*
    *Please mark it as Answered if it answered your question or mark it as Helpful if it helped you solve your problem.*

    Thursday, September 27, 2012 10:05 AM
  • Hi

    You could make a parameter optional by 

     1.) Setting the "Allow Null Value" checkbox to TRUE

    2.) Setting NULL as the default value for the parameter

    3.) In the main query /Dataset add a where clause which accepts NULL value for the parameter.

    For instance, if you have an Employee dropdown parameter @EmployeeName

    The Dataset should go something like;

    Select * From Employee_Information WHERE (EmployeeName = @EmployeeName or @EmployeeName IS NULL)

    This way the dataset would allow even NULL values making the parameter optional.



    Hope this will help you !!!
    Sanjeewan

    Thursday, September 27, 2012 10:16 AM
  • Thanks for your responses.

    I've managed to fix it myself by allowing parameter 1 and 2 to 'Allow blank value' and changing my SQL code to "IN (@parameter1, @parameter2)" 

    • Marked as answer by MJ2012 Thursday, September 27, 2012 11:36 AM
    Thursday, September 27, 2012 11:35 AM