Change Group based on Parameters passed to report

  • I have parameter x which could be 1 or 2 or 3 or 4 then

    1) I need to group the report by FieldA and

    2) display subreportA

    If the parameter x is 5 or 6 or 7 or 9 then

    1) I need to group by fieldB and

    2) display subReportB

    Please suggest how to do this.

    Thanks

  • Hi,

    Use switch in the expression value,

    =switch(parameter!parametername.value=1,Groupvalue1,

    parameter!parametername.value=2,groupvalue2,

    parameter!parametername.value=3,groupvalue3)

    use the same expression in the sub report visibility expression.

    Thanks

    Veeren.

    Thanks & Regards,
    Veeren.
    Ignore this if you feel i am Wrong. πŸ˜‰

  • I have put the two subreports srCalcProg1Totals,srCalcProg2Totals in the group footers.

    Now where do I say which subreport to execute/show and how?

    For example. (I know this syntax is not right)

    =Switch(Parameters!SortSeq.Value=1,srCalcProg1Totals,

    Parameters!SortSeq.Value=2,srCalcProg2Totals)

  • Hi Robot,

    can u please let me know what u r looking for.

    I have parameter x which could be 1 or 2 or 3 or 4 then

    1) I need to group the report by FieldA and

    2) display subreportA

    If the parameter x is 5 or 6 or 7 or 9 then

    1) I need to group by fieldB and

    2) display subReportB

    Please suggest how to do this.

    If u r looking for above one .....

    use this

    Switch( parameter! parameter x.value= 1,"FieldA", parameter! parameter x.value= 2,"FieldA", parameter! parameter x.value= 3,"FieldA", parameter! parameter x.value= 4,"FieldA", parameter! parameter x.value<>1 or parameter! parameter x.value<>2 or parameter! parameter x.value<>3 or parameter! parameter x.value ,"FieldB")

    or

    IIf(parameter! parameter x.value=1

    Or parameter! parameter x.value=2

    Or parameter! parameter x.value=3

    Or parameter! parameter x.value=4

    ,FieldA,FieldB)

    -----------------------------------------------------

    I have put the two subreports srCalcProg1Totals,srCalcProg2Totals in the group footers.

    Now where do I say which subreport to execute/show and how?

    As in above u said u have a parameter X if it is 1 or 2 or 3 or 4

    make hidden expression false for Subreport A

    else make the hidden expression false for Subreport B.

    Thanks,

    Veeren

    Thanks & Regards,
    Veeren.
    Ignore this if you feel i am Wrong. πŸ˜‰

  • Ok, if I'm understanding you correctly. I right click and go to subreport properties, 'visibility' tab, select option 'Expression'

    and put the expression-

    =IIf(Parameters!SortSeq.Value = 1, False,True)

    This worked, but displayed just first page. The subreport expects a parameter which I pass from the parameter's tab as =Fields!Two.Value

    This just displays subreport for value of Two.value I'm passing to it.

    By itself, the subreport works fine for the values. Please suggest

  • Hello,

    I have a question for u how u r passing the paramters to ur subreport ?

    usevally i will create a parameter in the subreport as well as in the main report ,and then i assign my main report parameter value to the subreport parameter(properties>parameters>add parameter >in expression select he parameter which u want to map)

    thanks

    veeren

    Thanks & Regards,
    Veeren.
    Ignore this if you feel i am Wrong. πŸ˜‰

  • My report has a set of parameters which execute a stored proc.

    When I designed the subreport, I pass it a parameter to test.

    When I run the main report, the resultset returns the data to the report, one of the fields is my group

    Now I pass this value to the subreport.

    How I did this? Right click the subreport (which is now in group footer of main report), go to properties> parameters tab, ParamterName gives the parameter I initially set of the subreport when I designed it, all I provide here the 'parameter value', which will be passed from the main report.

  • Actually, on subreport works fine now, but not the second one.

    When I try to execute the second one,

    [rsErrorExecutingSubreport] An error occurred while executing the subreport β€˜srCalcTotals’(THIS IS ACTUALLY THE FIRST ONE): One or more parameters required to run the report have not been specified.

    I don't understand why it is looking for the FIRST sub report.

    I don't know if you could help with that. I will try to google it.

  • Hi,

    I am sorry i really not understood what u r saying u have two subreports both have one paramter is that correct?...

    And the subreport is working fine whenu u r using that in main report its not working...

    πŸ™‚

    Thanks

    Veeren..

    Thanks & Regards,
    Veeren.
    Ignore this if you feel i am Wrong. πŸ˜‰

  • Yes, I have 2 sub-reports. One take two parameters, one from the resultset of main report and the other is one of the main report parameter. This subreport is now working fine.

    The other one takes one parameter only, from the resultset of the main report. This one is showing just first page. The data on this page is absolutely correct, but dosn't display any more pages. I can't understand why?

    BTW, I have placed one sub report in the group footer section. For the second one I Right clicked the group footer, and added a row below, and then placed the other sub report here. Is this the right place? Just wondering...

Viewing 10 posts - 1 through 9 (of 9 total)

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