locked
select all not working in Report RRS feed

  • Question

  • User496086301 posted

    Parameters:

    MemberTypeId,FullName,Active

    Active Parameter Properties:->Allow Multiple Values->Available Values:Active=0, Inactive=1

    Query:

    select UserId,FullName,Active from dbo.Users where MemberTypeId=@MemberTypeId and (Active=@Active) and (((FullName like '%'+@FullName+'%' or @FullName IS NULL) and @MemberTypeId=1) or @MemberTypeId=0)

    So the active will be a dropdown of Select All, Active,Inactive.

    Active and Inactive works but not select all. I would like to have an option of select all where it displays all active and inactive.

    Tuesday, July 21, 2015 6:53 PM

Answers

All replies

  • User-1716253493 posted
    select UserId,FullName,Active from dbo.Users where (Active=@Active) and (FullName like '%' + @FullName + '%' 
    or @FullName IS NULL) and (@MemberTypeId is null or MemberTypeId=@MemberTypeId)

    Tuesday, July 21, 2015 9:01 PM
  • User496086301 posted

    Not working with select all both active and inactive

    Wednesday, July 22, 2015 12:08 PM
  • User1644755831 posted

    Hello sushsudh,

    So the active will be a dropdown of Select All, Active,Inactive.

    Active and Inactive works but not select all. I would like to have an option of select all where it displays all active and inactive.

    You could try this.

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

    2.) Setting NULL as the default value for the parameter. I will assume that SelectAll will give me NULL value for the @Active. Then you could do something like this.

    select UserId,FullName,Active from dbo.Users where MemberTypeId=@MemberTypeId and (Active=@Active OR @Active IS NULL) and (((FullName like '%'+@FullName+'%' or @FullName IS NULL) and @MemberTypeId=1) or @MemberTypeId=0)
    

    Add @Active IS NULL condition so when select all is chosen all active and inactive users will be shown.

    Hope is helps.

    With Regards,

    Krunal Parekh 

    Wednesday, July 22, 2015 10:28 PM
  • User496086301 posted

    we can't select both Allow Null Value and Allow Multiple values.

    Either 1 only. 

    Thursday, July 23, 2015 1:09 PM
  • User1644755831 posted

    Hello,

    Please see this: https://www.mssqltips.com/sqlservertip/2866/sql-server-reporting-services-using-multivalue-parameters/

    set allow multiple then Can you please try it like this.

    select UserId,FullName,Active from dbo.Users where MemberTypeId=@MemberTypeId and (Active IN (@Active)) and (((FullName like '%'+@FullName+'%' or @FullName IS NULL) and @MemberTypeId=1) or @MemberTypeId=0)
    

    Hope this helps.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 23, 2015 10:30 PM