Skip to Content
avatar image
Former Member

pass multivalue as parameter to sub report

Hi,

I have a main report developed using the sql command. In the sql I have a filter condition

with multiple values Employee.Status=('P','C') , I don't want this to set as parameter prompted from user ,so I have coded in sql. I have a sub report where I need to link this Employee.Status field. In the subreport I have created a Employeestatus as parameter fileld .

could any one help to link main and sub report

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Oct 26, 2016 at 06:38 PM

    Hi Lalitha,

    Is your subreport linked on any other fields from the Main Report? I would assume Status is a field in the subreport as well.

    Instead of linking on a parameter, could you code the subreports Record Selection formula like:

    Employee.Status In ["P", "C"]; 

    This depends on how your report is formatted and where in the main report you put the subreport.

    Brian

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 26, 2016 at 09:02 PM

    Brian, that only holds true if you're using the Select Expert, which should NOT be done with a Command.

    Lalitha,

    If you haven't already, take a look at this blog post: https://blogs.sap.com/2015/04/01/best-practices-when-using-commands-with-crystal-reports/. Among other things, it explains how to work with multi-value parameters in commands. This type of parameter stores data in an array. However, you cannot pass an array that is defined in a formula to a subreport as a link. The only ways to get this into the subreport is to use a parameter in the main report and link from that to the parameter in the subreport or to hard-code the values in the subreport.

    If you want to link the subreport based on one value at a time, then you would link from the field value in the current record to the parameter in the subreport. If you need to link based on multiple values at the same time, you'll have to hard-code the values in the subreport instead of using a parameter.

    -Dell

    Add comment
    10|10000 characters needed characters exceeded