Function in Reporting

  • Hi All,

    I have to pass 2 parameter in SSRS. one is @fromID and another is @to ID.

    Values in Both paramerers is 1,2,3,4

    Means

    @From ID @ToID

    1 1

    2 2

    3 3

    4 4

    Now @ToID is Depends on @FromID.

    Means i want a output in Combination of

    @From ID @ToID

    1 2

    1 3

    1 4

    1 5

    2 3

    2 4

    2 5

    3 4

    Also Someone select

    @FromID =2 and @ToID=1 then it's automatic select @fromID=1 and @ToID=2

    Same Thing for All possible combination like

    @FromID =3 and @ToID=1 then it's automatic select @fromID=1 and @ToID=3

    @FromID =4 and @ToID=1 then it's automatic select @fromID=1 and @ToID=4

    @FromID =3 and @ToID=2 then it's automatic select @fromID=2 and @ToID=3

    @FromID =4 and @ToID=2 then it's automatic select @fromID=2 and @ToID=4

    @FromID =4 and @ToID=3 then it's automatic select @fromID=3 and @ToID=4

    Please let me know...How can I do ?

    Can I do with function in reporting so please explain me or any other way that would be greatful

    Thanks

    P

  • are you using the two values for the BETWEEN ...AND operator?

    if that's true, you could work around it with a case statement to make sure the lower value is used for the range correctly;

    DECLARE @val int,

    @val2 int

    SET @val = 20;

    SET @val2 = 10

    select * from SOMETABLE

    where ID between CASE WHEN @val < @val2 THEN @val ELSE @val2 END

    and CASE WHEN @val2 < @val THEN @val2 ELSE @val END

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply