Passing database command parameter to sub-report

I'm trying to pass a runtime parameter from a main report to a database command parameter in a sub-report, and having some trouble.
My main report has parameter fields (Vendor, Manufacturer, etc) that the user selects at runtime - the result set includes Item Code - that part is working fine.  Where I'm having trouble is with linking to the sub-report.  My sub-report has a stored command that takes a parameter (ItemCode) and counts the number of times it's shown up on an invoice.  When I created the command, it asked for a value for the parameter, and won't accept a blank entry.  Now, whenever I try to run the main report, it asks for the ItemCode parameter for the sub-report - which kind of defeats the purpose.  I've tried linking from ?Pm-OITM.ItemCode in the main report, but the Subreport Links window doesn't show the Command parameter to link to.
How do I take a field from the main report and pass it to a sub-report to be used as a parameter in a stored database command? 
I'm running CR 2008, and SAP B1 2007 PL 42 on MS SQL 2005, and I'm still pretty new at CR, so details help.
Thanks.

Go to change subreport links and add Item Code from main report and then you can see the sureport stored procedure parameter in the Subreport parameters list, select the parameter and do not select any field from subreport.
You will be able to see the stored procedure parameter in the list only when the Item Code and the parameter are of same data type.
Regards,
Raghavendra

Similar Messages

  • Pass multi value parameter to sub report in Drill through report, ssrs

    I have two reports 1 is subreport and other is main report. Date Field are placed in both reports. i have groups in main report,
    one group is task. In the task fields one persons is working in 3 project, two project are same company and 1 is for other and it give me count for each project. I
    want when i click on link it send multivalue parameter to subreport and it just show matching records.
    Asif Mehmood

    As I understand what you need is to use LookupSet function. 
    Suppose if your dataset is like this (for simplicity I'm showing only required fields)
    PersonID Project Company
    ID1 P1 C1
    ID1 P2 C1
    ID1 P3 C2
    ID1 P4 C2
    ID1 P5 C3
    If you want to get the full project list for the person just send the PersonID alone and filter using it in the subreport. You can keep the project/company parameters optional in that case and put a default value. This would be the easiest thing.
    Now if you want pass the project parameter also you need to pass it like this
    =Join(LookupSet(Fields!Person.Value,Fields!Person.Value,Fields!Project.Value,"DatasetName"),",")
     This would act like a self lookup and return you full list of projects for the person and then you can use this to set the parameter value in the subreport.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Passing Multivalued parameter to sub report in SSRS

    Hi Team,
    I tried passing multi valued parameter to sub report in SSRS but the report is blank.
    Rgds,
    Shree

    Hi Shree,
    As per my understanding, the issue is caused by the multiple-value parameters are not passed from the main report to the subreport correctly. Please refer to the steps below to check whether you configure the subreport parameter settings correctly:
    Drag a Subreport control from toolbox to design surface.
    Right-click the Subreport to open the Subreport Properties dialog box, then select the correct report as subreport.
    Click Parameters in the left pane.
    Add parameters as below (Parameter1 is a single-value parameter, Parameter2 is a multi-value parameter in subreport ):
    Name: Parameter1              Value: [@ReportParameter1]
    Name: Parameter2              Value: =Split(join(Parameters!ReportParameter2.Value,","),",")
    Please also directly select or type the same values in subreport to check whether the subreport works well with those parameter values.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to pass in a parameter into a report viewer on a jsp - and hidden

    Hi, I've built a php application and am using the java environment to enable the crystal report/viewer.  The developer was looking how to pass in a parameter into a report viewer on a jsp. Ultimately the end product we need is to get an HTML report viewer loading a report file with hidden parameters so to not expose other customer data (it's a shared database for multiple customers) preferably loaded from php using maybe the php java bridge. Would anyone happen to have any sample code or any guidance?
    <%@ page contentType="text/html; charset=UTF-8"
       pageEncoding="ISO-8859-1"%>
    <%@ taglib uri="/crystal-tags-reportviewer.tld" prefix="crviewer"%>
    <%
    // just a test to grab rpt name from GET
    String rptFile = "report_files/" + request.getParameter("rpt");
    %>
    <crviewer:viewer reportSourceType="reportingComponent" viewerName=""
    isOwnPage="true">
       <crviewer:report reportName="<%= rptFile %>" />
    </crviewer:viewer>
    Many thanks in advance!
    Mark

    I am not aware of any html tags you can pass to the viewer for parameter values.  Normally, you would load the report in code and then use the SDK with the report object to pass parameter values.

  • Passing Parameter to sub report from detail section of Main report

    I am new to CR
    I am developing a CR for Clinical Lab Test. My main report have four field i.e
    1. Test Code
    2. Test Name
    3. Result Value
    4. Normal Values
    This report has sub report in Page Footer. When TestCode = 18 or 19 It has to show a normal value table in Page footer of that page. Other wise this table should not appear on page footer.
    Please help me

    Hi Qasim,
    Go in Section Expert and select the page footer.  You will find Suppress in right side of the window, go in formula editor and give the follwoing formula :
    If Testcode<> 18  or Testcode <> 19 Then true
    Thanks,
    Sastry
    Edited by: Sastry Duvvuri on Oct 14, 2008 7:10 PM

  • How to pass SQL command parameter using OpenDocument

    Hi !
    I have a dynamic List of values configured in Business View manager, used across multiple reports.
    The data source for this LOV is a SQL Command which accepts a static parameter named stringParam. I need to pass this static parameter in the URL using OpenDocument command. How can I do this?
    I tried
    http://bobjdev/businessobjects/enterprise115/InfoView/scripts/opendocument.aspx?spath=[ReportFolder]&sDocName=WebReport.rpt&stype=rpt&lsSstringParam=ABC
    but it still prompts me to select the parameter. I need to avoid this prompt.
    Any help, please.

    Hi,
    I would recommend to take a look at the documentation in order to identify the correct syntax for your URL
    [http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_url_reporting_opendocument_en.pdf]
    Regards,
    Shweta

  • Passing Parameters to Procedure based sub report thru JRC

    Hi
    I am using storedprocedure based main report with a subreport and i am trying to invoke these reports with JRC.
    I am passing parameters to main report then it is asking parameters for subreport then i placed following statement by placing subreport name
    param2.setReportName("detailed_aging_report_wk.rpt");
    but after using this statement it is prompting for main report parameters.
    How i can pass the same parameter values to both main and sub reports?
    Thankyou.

    Here is a snippet code that demonstrates how to pass a parameter to a subreport, you can accommodate it and test it and see if you still have the same behaviour. What you need to do is to add the code to set the parameter of the main report.
    <%
    /* Applies to: XI
    * Date Created: April 4, 2005
    * Description:     This sample demonstrates how to pass parameters to a report that
    *                    contains a subreport using the Crystal Reports Java
    *                    Reporting Component (JRC) SDK.        
    * Author: HP, CW
    try {
         //check to see if the report source already exists
         Object reportSource = session.getAttribute("reportSource");
         //if the report source has not been opened
         if (reportSource == null)
              //---------- Create a ReportClientDocument -------------
              ReportClientDocument oReportClientDocument = new ReportClientDocument();
              //---------- Set the path to the location of the report soruce -------------
              //Open report.
              oReportClientDocument.open("jrc_set_subreport_parameters/jrc_set_subreport_parameters.rpt", 0);
              //Get the report source
              reportSource = oReportClientDocument.getReportSource();
              //Cache report source. 
              //This will be used by the viewer to display the desired report.
              session.setAttribute("reportSource", reportSource);
         //---------- Create the Parameter Field Objects -------------
        //Create a Fields collection object to store the parameter fields in.
        Fields oFields = new Fields();
        //----------- Initialize the parameter fields ----------
        //Set the name and value for each parameter field that is added.
        //Values for parameter fields are represented by a ParameterFieldDiscreteValue
        //or ParameterFieldRangeValue object.
        //NOTE: Be sure to map the names of the parameters and their
        //respective types against the correct type that the parameter
        //field values was defined to accept in Crystal Reports.
        //NUMBER VALUE PARAMETER. 
        Integer numberValue = new Integer("55");
        //STRING VALUE PARAMETER.
        String stringValue = "String parameter value.";
        //BOOLEAN VALUE PARAMETER.
        Boolean booleanValue = new Boolean("true");
        //DATE VALUE PARAMETER.
        Calendar calendar = Calendar.getInstance();
        calendar.set(2004, 1, 17);
        Date dateParamVal = calendar.getTime();
        //DATE-TIME VALUE PARAMETER.
        Calendar calendar2 = Calendar.getInstance();
        calendar2.set(2002, 5, 12, 8, 23, 15);
        Date dateTimeParamVal = calendar2.getTime();
        //CURRENCY VALUE PARAMETER.
        Double currParamVal = new Double(555.99);
        //TIME VALUE PARAMETER.
        Calendar calendar3 = Calendar.getInstance();
        calendar3.set(2002, 5, 12, 13, 44, 59);
        Date timeParamVal = calendar3.getTime();
        //Set all of the parameter values using the utility function.
         //Since we are passing parameters to the subreport, it is here that we set the
         //subreport name; if you are not passing a parameters to a subreport, the
         //report name will be an empty string
         setDiscreteParameterValue(oFields, "NumberParam", "SubreportA", numberValue);
        setDiscreteParameterValue(oFields, "StringParam", "SubreportA", stringValue);
        setDiscreteParameterValue(oFields, "BooleanParam", "SubreportA", booleanValue);
        setDiscreteParameterValue(oFields, "DateParam", "SubreportA", dateParamVal);
        setDiscreteParameterValue(oFields, "DateTimeParam", "SubreportA", dateTimeParamVal);
        setDiscreteParameterValue(oFields, "CurrencyParam", "SubreportA", currParamVal);
        setDiscreteParameterValue(oFields, "TimeParam", "SubreportA", timeParamVal);
        //Push Fields collection into session so it can be retrieved by the viewer and set
        //at view time.
        session.setAttribute("parameterFields", oFields); 
         //Redirect to the viewer page to render the report
         response.sendRedirect("CrystalReportViewer.jsp");
    catch(ReportSDKException sdkEx) {
         out.println(sdkEx);
    %>
    <%!
    * Utility function to set values for the discrete parameters in the report.  The report parameter value is set
    * and added to the Fields collection, which can then be passed to the viewer so that the user is not prompted
    * for parameter values. 
    private void setDiscreteParameterValue(Fields oFields, String paramName, String reportName, Object value) {
         //Create a ParameterField object for each field that you wish to set. 
        ParameterField oParameterField = new ParameterField();
        //You must set the report name.
        //Set the report name to an empty string if your report does not contain a
        //subreport; otherwise, the report name will be the name of the subreport
        oParameterField.setReportName(reportName);
        //Create a Values object and a ParameterFieldDiscreteValue object for each
        //object for each parameter field you wish to set.
        //If a ranged value is being set, a ParameterFieldRangeValue object should
        //be used instead of the discrete value object.
        Values oValues = new Values();
        ParameterFieldDiscreteValue oParameterFieldDiscreteValue = new ParameterFieldDiscreteValue();
        //Set the name of the parameter.  This must match the name of the parameter as defined in the
        //report.
        oParameterField.setName(paramName);
        oParameterFieldDiscreteValue.setValue(value);
        //Add the parameter field values to the Values collection object.
        oValues.add(oParameterFieldDiscreteValue);
        //Set the current Values collection for each parameter field.
        oParameterField.setCurrentValues(oValues);
        //Add parameter field to the Fields collection.  This object is then passed to the
        //viewer as the collection of parameter fields values set.
        oFields.add(oParameterField);
    %>
    Cheers

  • Passing Parameters to anf from Sub-Reports

    I have a report with two subreports in it, and I want to be able to tell the main report about the data in the sub-report so I can supress a detail section if the sub-report contains certain data.  How do I pass a parameter from the sub-report to the main report?

    Passing a variable from subreport to main report and vice versa
    Declare a variable as shared in the subreport.
    Shared numberVar NoOfrecords;
    Assign some value to this variable,
    Shared numberVar NoOfrecords :=Count()
    Then in the main report, create a formula and in that formula again declare the vairable and use it as u like
    //Declaration
    Shared numberVar NoOfrecords;
    //If you want to supress a section based on this count,then
    if NoOfrecords = 0 then TRUE
    click ok..
    NOTE:
    For the shared variable to return the correct value in the main report, you must place @MainFormula in a main report section that is beneath the section containing the subreport. This ensures Crystal Reports evaluates the @SubFormula before @MainFormula.
    Very Important : Dont just create the formula, u have to place this forula somewhere as mentioned above. If u dont want to show this formula value,then hide it by changing its colour to white or by some other way. If u dont place the formula in the report,it wont work.
    and same thing applies when passing values from main report to subreport.
    In this case define the @MainFormula first and then @SubFormula.
    I have used this successfully in my report.

  • Crystal runs sql command of first sub report in the second sub report ?

    Hi,
    I have report that contains 3 sub reports.
    Each subreport is running his own sql command to retrieve it's data.
    When moving from the first subreport to the 2nd subreport, we see on the oracle that the crystal runs the sql command of the 1st subreport, and then the sql command of the 2nd subreport.
    The results are fine (he ignores the 1st subreport result in the 2nd subreport), but it delays the showing of the 2nd subreport to show.
    Why? The 2nd subreport doesn't need the data of the 1st subreport!
    How do I cancel that????
    BTW - The 3rd subreport is running only his own sql command (As should be).
    Thanks.

    Hello,
    Not without more info about the report and the data. If there is nothing linked from the main report to sub1 then it's going to run and return all data, no filtering. And from the sounds of it to take 5 + minutes per query this is going to affect performance for the whole report.
    You may want to re-evaluate why and what the subreports are used for. If they all use the same data the link them in the main report use groups to sort the data.
    Having subreports in the Details section is asking for performance problems, every record returned will cause the subreport to run. Not knowing what the subs are doing I can't say for sure....
    What you should do also is re-evaluate your Commands for each sub and see if you can do it either in one SQL statement or write a Stored Procedure to do all of the data collection. DB Servers are much more efficient at collecting data than CR will ever be. Pushing just the results to CR makes it simply formatting the results in the Designer and no performance hits....
    Talk to your DBA on how to optimize your Command SQL's and how to get them into one SQL or into a SP that dumps the final results into a final SQL * from TEMP Table into Crystal.
    Don

  • Pass a value from a sub report back to a main report

    This may not be possible but i though i would see if i had any options.
    I have a main report with sales data and a sub report with budget data in the footer. Neither are linked to each other as i do not have a common field.
    I was hoping to bring a value through from the sub report to the main report or vice versa for a calculation. Its just one calc to work out the percent of sales against budget. sales/budget total.
    stuck!
    Any help would be appreciated.

    Thanks for the reply but this has not worked.
    I created a formula field on the main report HEADER @myValue with:
    Whileprintingrecords;
    Shared numbervar myValue:=0;
    Then I created a formula field in the sub report @myValue with:
    Whileprintingrecords;
    Shared numbervar myValue;
    myValue:= {@Budget-Month};
    @budget-month being the field i want to pass through to the main report.
    I placed this formula in the same section as the @budget-month formula field which is in the report footer
    Then i created a formula field @AVG, added it to a new section below the current fields and used the below
    Whileprintingrecords;
    Shared numbervar myValue;
    //calculation using MyValue
    {@myValue}/{@Sales Total}
    I get an error with the @myValue part in this formula "a number or currency amount is required here"
    I did have to change the Shared number from your formula to shared numbervar as number was not accepted. Does that matter?

  • Parameter in sub report

    Hi,
    How can I transfer data from sub-report to the main report with the parameter. For example, Total field in sub report should be transferred to Total1 in the main report
    Thanks,
    Olga

    You may check these threads:
    Accessing Shared variables of sub-report in main report.
    Re: crystal reports - how to call required sub report into main report
    Thanks,
    Gordon

  • How to pass an integer parameter from main report to subreport?

    I don't understand why this isn't working, but I have a main report with parameters:
    StartDate=datetime,
    EndDate=datetime,
    Program=text,
    ChartType=text.
    In this RDL, I have a chart with Action configured on this bar chart series.  The Action expression is:
    ="javascript:void(window.open('http://evolvssrs/ReportServer/Pages/ReportViewer.aspx?%2fIncoming%2fCensus+Report+Modifier&rs:Command=Render&rc:Parameters=true&StartDate=" & Parameters!StartDate.Value & "&EndDate=" & Parameters!EndDate.Value & "&Program=" & Fields!program_info.Value & "&ChartType=" & Fields!ChartType.Value & "','_blank'))"
    (program_info is a FIELD uniqueidentifier value matching the value of the Program parameter).
    So for this subreport, I have tried ChartType parameter as both integer and text, but each time i click on a bar from the main report, it opens a new window with ChartType field empty.  But the other 3 parameters: Start Date, End Date, and Program are
    all populated.  Why is it doing this and how can I fix please?
    Ryan D

    Hi Ryan,
    If I understand correctly, you have got empty in the ChartType parameter text box when you enable go to URL action.
    In my test, if the value we pass to the subreport which is not include in the parameter available values, we would get the empty text box. Please check if it has the specific ChartType values in the subreport parameter available values.
    Alternatively, please check if it has pass value to the subreport. We can add a parameter without available values and default values to check if it is can accept the Field ChartType Value from the main report.
    Hope this helps.
    Regards,
    Alisa Tang
    If you have any feedback on our support, please click
    here.
    Alisa Tang
    TechNet Community Support

  • Pass a form parameter to the report stored procedure

    <CFSET myVar= "1">
    <cfquery name = "mydata" datasource = "myDSN">
        execute MySP
       <cfqueryparam value = "#myVar#" CFSQLTYPE = "cf_sql_integer">
      </cfquery>
       <cfreport format = "PDF" template= "MyReport.cfr"
        query = "#mydata#">
       </cfreport>
    I have above code to generate the report using stored procedure and pass parameter.
    I have to use CFSET to set the value of MyVar.
    I would like to know how I can use user input value in  my text control on the form.
    Your help and information is great appreciated,
    Regards,
    Iccsi,

    Hi ,
    Any help from Oracle please....
    Thanks
    Vishnu

  • How to activate a different sub-report for each row in the data set as main report page breaks on each row of data in the main dataset

    I am going to try asking this same question a different way as I have yet to find a working solution to my problem.  I have a main report and then 8 sub reports.  My main report has one data set and returns one row of data per account number.  One
    of the fields in the main data set is called AccountProf.  My main report displays one page per Account number and then calls a different sub report based on that account's AccountProf value.  The sub reports take in the account number as a parameter
    and get multiple rows of data to display that accounts usage formatted differntly for each AccountProf (hence the 8 different sub report.  
    So far I can figure out how to do everything but setting the visibility property of each sub-reports when I have multiple accounts.  If I use the following expression for the visibility property on each sub report, it makes all the applicable sub report
    for all the accounts requested visible at once:
    =IIF(Fields!AccountProf.Value= "USE_PLUS_DMD",False,True)
    *The value in bold USE_PLUS_DMD  is different for each sub report.
    Here is a look at what the main report look like:
    Here is the main reports data set:

    Hi JasonDWilson77,
    According to your description, there is a main report and 8 sub reports in the report, you want to set visibility of sub reports, if no value is passed to the parameter of sub report, the sub report will not be displayed. If that is the case, please refer
    to the following steps:
      1. Create a new parameter named NewAccountNumber, set its data type the same as @AccountNumber, select Allow multiple values, set Visibility to be hidden, then set all available values to default values.
      2. Right-click the first sub report and open Subreport Properties dialog box, click Parameters in left pane, set name to AccountNumber, then click (fx) button, type the expression like below:
    =Parameters! NewAccountNumber(0)
      3. Click Visibility in left pane, select Show or hide based on an expression, then click (fx) button and type the expression like below:
    =IIF(InStr(Join(Parameters! AccountNumber.Value), Parameters!NewAccountNumber.Value(0))>0 , false,true)
      4. Modify parameter of other sub reports like step2.
      5. Set visibility of other sub reports like step3.
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    If you have any feedback on our support, please click
    here.
    Wendy Fu
    TechNet Community Support

  • Passing Parameter from Main report to SQL command-based subreport

    I am trying to cut down the run time of my reports and have recently figured out how to write SQL commands to limit the data by filtering prior to being pulled into the reports.  However, many of my reports rely on multiple sub reports, which can cause a dramatic 'drag' on the report.
    I am trying to filter the SQL command used in my sub report by passing the group parameter, which is selected by the user in the main report, to the sub report's SQL command.  Without this parameter, the sub report has to sort through a lot more data than it would with this parameter, making the run time extremely slow.
    Any suggestions on how I can accomplish this?
    Thanks for any help you can provide,
    Marlene Allen
    Crystal Reports Developer
    Crystal Reports Professional;
    Product Type: Full;
    Product Version 11.5

    Hi Marlene,
    I don't believe you can pass a CR parameter to a Command object.
    I suggest replacing all of the Command Objects with a Stored Procedure so all of the data filtering is done server side. DB servers are much more proficient at collecting the data and filtering than CR will ever be. It will also allow you to replace subreports to also speed up your report processing. All depends on your layout of course but something to look at.
    Thank you
    Don

Maybe you are looking for

  • Java file not included .

    I have: import org.eclipse.swt.widgets.Shell;in my program. But this is showing a 'cannot resolve' error. I found that this file was actually in a winzip extractor,so I extracted it in the workspace folder .But it is still not accessible. I cannot fi

  • Suddenly G4 no longer connects to internet

    My wireless internet has worked effortlessly for years, but suddenly my G4 decides it can't find it. A few days ago, it started asking for the password which was odd, but now no response. The signal is completely full and all other laptops and comput

  • Best approach to convert HD camcorder footage to blue-ray (and archive)

    I have a Canon Vixia HV30 camcorder that I have used to take HD footage.  I would like to archive the tapes' raw footage (for backup purposes) and also burn a blue-ray for each tape.  Prior to the Canon (and switching to Macs) I had been using Studio

  • Cannot synk from itunes with new hp pc frustrated!

    I have an i pod Touch which i really like as does my wife. Problem purchased new HP desktop transferred from old to new problem i tunes does not identify with my new PC. Not to computer savy but a pretty good listener. Any suggestions will be appreci

  • Disp Work Process stoopes

    Dear Sir, we are runing windows 2008 with db2, now server is not getting up disp+work process show stooped. here is siap Log ======================================================= Running with CLI driver. C *** ERROR in DB6Connect[dbdb6.c, 1737] CON