Main/Sub Report Passing Parameter

This is a twist on the general passing parameter question:
1. The main report is a detail report based on a stored procedure.
2. The sub report is also based on a stored procedure. This SP calculates the values that will be introduced into a 'table' drawn on the report canvas. The SP consists of a CTE which is a 'reduced' version of the Detail SP used in the main report - to ensure that all the same records are being retrieved between the main and sub reports. Another select, following the CTE, sums the values and makes them available to the Sub Report.
The client has requested the availability to view records where an Activity Date falls within the last full week, the last month, this month, and YTD. The report is available both through Infoview as well as a scheduled version. The client wants to make a selection as to time period through Infoview.
Most other users will be using a printed copy of the 'general' report.
I thought to use the SAVED DATA in SELECTION REPORTS and use Crystal functions to handle this. The SAVED DATA and an optional parameter allowed the user (in Infoview) to change the parameters. This works fine in the main report.
HOWEVER, the sub report needs to update the totals for the groups of properties that are aggregated in the sub report's summary Stored Procedure. Since the time range will, on changing in the Main Report, reflect different counts,  I need to be able to tell the sub report what the main report is doing.
The Main report has an Optional Parm ({?Account Open}) which allows the selection of a data range
The SAVED DATA selection uses the values from the parm:
if not hasvalue({?Account Open}) then 1=1
    else if hasvalue({?Account Open}) and {?Account Open}=0 then 1=1
    else if hasvalue({?Account Open}) and {?Account Open}=1 then {Account_open_date_newest}in LastFullWeek
    else if hasvalue({?Account Open}) and {?Account Open}=2 then {Account_open_date_newest}in LastFullMonth
    else if hasvalue({?Account Open}) and {?Account Open}=3 then {Account_open_date_newest}in Yeartodate
    else if hasvalue({?Account Open}) and {?Account Open}=4 then {Account_open_date_newest}in CDateTime (CurrentDate-(DayOfWeek(CurrentDate)+1),CTime(00,00,00)) to CDateTime (CurrentDate+(7-(DayOfWeek(CurrentDate))),CTime(23,59,59))
    else 1=0;
My problem in passing the optional param selection made by the user down to the sub report in order to update the counts.
Any help would be gratefully appreciated! I have included a snap of the Table from tyhe subreport and a snap of the optional parm from the Main Report

Jamie -
Thank you for your reply. I've spent the morning working on the two directions you had provided me with.
Cross tabs: I took one report, created a cross tab for it, and, as expected, it worked as desired. The issue I'm having is where to place it on the report canvas. If I'm correct, the only place where it can be placed is in a header or footer - the sub report is currently residing in Page Header D (there's a lot of suppression and reveals in these reports). The cross tab does not want to be placed there. It's currently living in the Report Header... further, the cross tab occupies page 1; the remainder of the report starts on page two. Not what needs to happen. The current business specification for the report is: Page 1 includes a page header which includes (through iterations a-e) logo, print date info, the sub report showing the summary a series of group headers which in effect creates an index into the various business units. By clicking on a business unit, any groups under it are exposed. By clicking on the sub group, customer data is exposed. As you go to the 'next page', the Summary sub-report is eliminated and the groups under the Business Unit are shown. All of these dynamics are based on section suppression and unhiding based on the user's interaction, which why the placement of the Summary data is important. If you have any hints on managing the cross tab and its placement, I would be eager to hear them.... (btw - the number of rows in the cross-tab can range from 0 to 12. That dynamism is not a problem with the sub report - would it be for the cross tab?)
Parameter Passing: I took one of the reports and (1) ensured that the sub report had the exact  same parameter (called Account Open) as the Main Report. (2) ensured that the Saved Data filters in both reports were the same. (In order to do that I had to update the stored proc for the sub report to include an account date field). (3) I then went to link the two reports selecting the Account Open parameter in both the containing and the Fields to Link To list boxes (see the graphic LINK.JOG. This produced no useful result - the Summary showed ALL records- the container report properly showed the count for last full month (see SUMMARY.JPG) (4) I then tried to link a field from the sub report to the Parameter, but only 4 of the six fields from the stored proc's select were displayed. (Prior to this Select there is a CTE which collects the data with a ROW OVER.. PARTITION function):
SELECT
customer_business_unit_name,
account_open_date_newest,
sum (CASE WHEN currentrisk =1 THEN 1 Else 0 End) lowcount ,
sum (CASE WHEN currentrisk =2  THEN 1 Else 0 End) midcount ,
sum (CASE WHEN currentrisk =3 THEN 1 Else 0 End) highcount,
sum (CASE WHEN currentrisk =0 THEN 1 Else 0 End) unknown
FROM    records
WHERE   rn = 1
group by customer_business_unit_name,account_open_date_newest
Only the COUNT fields show up in the Fields box (see the graphic LINKS CHECKED.JPG).
Where have I gone wrong??
Again, thank you for your earlier reply.

Similar Messages

  • Sub-reports displaying parameter prompt

    I have a CR XI r2  application using the JRC that displays a list of reports and allows a user to select the desired report. I then programatically determine the paramaters needed and set the values required. This works fine except when I use a report containing a sub-report. Although I loop thru the report heirarchy including the sub report and set all the parameters it still prompts for the sub-report parameter in the viewer before displaying the report. I tried setting the enable prompting to false but that didn't help.

    Hi,
    It may help you.
    Try to link the subreports with the main report Using Change Subreport Link.
    And map the parameters to the main Report.
    Thanks,
    Saravanakumar..

  • Looping thru sub report based on dataset in main report.

    Hello all,
    I have a report which has few parameters and I scheduled  it to run and export in excel. This report run multiple time based on parameter value and then export the data into different excel file. 
    Here is what I'm looking for:
    1. Create a main report with temporary data set with all the parameter values.
    2. Run sub report with parameter values from main report and then export it to excel file, I assume it will help to create one single excel file with multiple tabs.
    Questions are:
    1. How I can create s dataset in main report (may be use XML as a data source) and write a query? Since I don't have access to database I cannot add a table for parameters values so I need to know how I can create a dataset with all the values
    2. Is this a right approach or there is a another way to handle it?
    Look forward for expert advice.
    Thanks,
    P

    Hi Parry2k,
    According to your description, you want to create a report with several parameters and configure subscription to send delivery the report to users, but you haven’t permission to access database.
    According to my knowledge, as long as a user can connect to a SQL Server instance, the user is able to create temporary tables, there are no special permissions. To use XML as data source, we can select XML from type drop-down list, then embed xml in dataset
    query text box.
    To set parameter values, we can create Available values and Default Values manually or create datasets for the parameter, then get values from the datasets.
    In this case, I would recommend you asking database administrator to grant permission to access database to you. Creating temporary tables is not a good approach to solve the problem.
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • Pass parameter from main report to sub report?

    Post Author: nomore
    CA Forum: General
    I have a report which is comparing turnover from present year to previous year.Im trying to make it dynamic - so i have added a parameter to the main report to allow user to enter a year, however I cannot work out how to pass this to the sub report so select records based on this. I have passed the data thruogh a fomula ok (WhilePrintingRecords; Shared NumberVar shYear;)  and that is working spot on.Now i just need to enter that number as a record select paremeter. Also if I try to perform a summary on this field (it never changes, but its just a test) - the 'Insert Summary' option is unavailable, and it doesnt show up as a formula in formula editor.  

    Post Author: V361
    CA Forum: General
    I have CR XI, you want to edit your subreport links, right click the sub, select Change subreport links, you should be able to select your field, and see your parameter listed.  Once you set up the link the sub will run based on whatever link you picked.

  • 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

  • Resultset of main report passed as parameter to child report stored proc

    Post Author: chicagolad
    CA Forum: Data Connectivity and SQL
    I seem to be in a bind with this issue. I have a main report and sub report. The main report takes in a comma seperated value as a parameter to the stored procedure. The result set of which is used to group 20 sub reports. These subreports use a different stored procedure to which I need to send the group value which is a part of the result set table I get for the main report. Come what may, I am not able to link the main report with the sub report.
    To repeat the question, how do i pass the a result column of the main report as parameter to the sub report stored procedure? Any insight will be much appreciated.
    TIA
    chicagolad

    Raghavendra,
        It seems that no matter what I do, using the parameter ?TagNumber as the item to link from in the main report (Subreport Links) will not give any results no matter which item I link to in the subreport, but if I use the specific data item that the parameter represents, then any of the choices in the lower left "subreport parameter field to use" will work.  So I can simply use the specific data item and everything works fine. It's strange, as last week using the parameter of the main report worked, but as I have a working solution I don't have to resolve that.  (There was data for the parameter value,as I printed the parameter value in the report and the selected value was shown.).
       This is now resolved.  Thanks for your help.
    Don

  • 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

  • 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

  • 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

  • How to pass a 'one of' parameter value to a sub-report

    I'm using CRXI.
    If I have a parameter which is a 'one of', what are my options for passing the values of that parameter to a subreport?
    Specifically I would like to know:
    Is this a good solution: convert the 'one of' parameter to multiple formulas(one forumula for each of the possible values), and then link the subreport to the main report on each of those values?

    Thanks for responding, but I dont think you understood my question.
    Let me ask the question again a little differently, here are my assumptions, maybe they are incorrect.
    1. Parameters are passed to sub reprots by setting the parameter equal to a forumla, and then linking the sub report to main report through the formula.
    2. If the Parameter is a 'one of' (ie can be multiple values), it can only be set equal to a forumula if you make the forumula an array.
    3. You cant link a sub report to a main report on two formulas which are arrays.
    4.Therefore how do you handle this situation?

  • Is it possible to pass a formula value from a sub-report to a main report

    Hi there,
    Im trying to pass a formula value from a Sub-report back upto into my Main report but the value doesnt seem to be getting passed up. Ive tried it the other way around, that is, passing a value from the main report to the sub-report and that works fine.
    Below is an example of what I am trying to do but it is not working. In my sub-report Ive declared a formula variable as,
    formula name=main_subIntRatePageCount
    Shared NumberVar subIntRatePageCount := TotalPageCount;
    and in the Main report Ive declared the formula variable as,
    formula name=subIntRatePageCount
    Shared NumberVar subIntRatePageCount;
    subIntRatePageCount;
    I want the value assigned to "subIntRatePageCount" in my Sub-Report to be available to my Main report.
    The problem I am trying to solve is that the sub-report is spilling over onto two pages, and I need a way of updating the page display on the main report to reflect this. The page display is of format, "displaying page 1 of  3", but its not taking into account the extra page produced by the sub-report, so it should say "displaying page 1 of 4".

    Also thanks Raghavendra, Asha,
    I've tried adding the "whileprintingrecords" statement but that doesnt seem to make any difference.
    I notice that the subReport is being called from my the GroupFooter section of the main report, and I am trying to reference the variable in the main repot in the Page Footer section. Could it be that the variable hasnt been calculated in the Page Footer by the time I calculate it in sub-Report? I thought Crystal Reports does at least 5 passes over the report evaluating all the formulas before it prints the report?
    The problem Im trying to solve is I need to know how many pages my report will have before its completed, so that i can print the statement "displaying page 1 of X", and X is currently not being calculated correctly because the sub-report is printing onto 2 pages and not 1 so the report thinks I have 1 of X pages and not X+1.
    Regards
    Robert.

  • Passing a parameter from a web application to the sub report.

    Hi I am currently passing a parameter from the webpage into the main crystal report.  I would like to pass this same parameter to the subreport but when I right click on the subreport from the main report I can find the parameter on the main report but there is nothing to link it to on the subreport (since this window just shows the dataset).  I also tried adding a parameter to the subreport but it does not show up in the link window on the (select data in subreport to link to).  I am using vs2005 and the crystal reports that comes with this.
    Thanks.

    Hi, Paul;
    There are many samples on our site that show passing parameters to both main reports and subreports. Have a search at
    https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_codesamples&query=vb+net&adv=false
    Regards,
    Jonathan

  • How to pass the value from Sub report to main report

    I have un report(mainreport) within a subreport(subreport).
    With reporting services, how to pass the value from Sub report to main report?
    thanks

    Hi Alebet,
    With reporting services to pass values from sub report in to main report is not supported directly.
    But there are some workarounds through which you can get this .
    There are two ways to get this.
    1- Put your sub report query into some table. i mean to say through the subreport query get some temporary table.
    2- Using this temporary tables data write some Scala function in the data base.
    3- Now in your main report query return this scala function as a column.
    4- Extract the column value where ever you want in your main report which is getting calculated from the subreport query. so you will be getting the values returned from the subreport in the main report.
    This will definitely work fine as i have done some report in this way.
    Another way of doing is that
    1- prepare another data set with the same query as in sub report in the data tab.
    2- then refer this 2nd dataset in your main report .
    But better way will be the top one.
    Anyway please let me know if you get the solution.
    Thanks
    Mahasweta

  • 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?

  • Passing values from main report to sub-reports

    - How do we pass values from main report to sub-report?

    Look at this link which shows how to pass values from a subreport to a main report.
    http://www.datamanagementgroup.com/resources/trainerstalk/trainerstalk_howto_share_subreport_data_with_main_report.asp
    You can use the same method to pass values from main report to a subreport.
    1) Create a formula @mainFormula in the main report, as given in item 1 of link.
    2) Place this formulla in a suppressed report footer section above the target subreport.
    3) In the subreport, create a formula @subFormula that declares the same variable name, as given in item 3 of link.
    4) Place @subFormula column in the subreport where you want to display it.

Maybe you are looking for

  • No Reproduction of a problem in a Web Session (ECO 5.0)

    We use the new E-Commerce 5.0 version on a NetWeaver 2004s (Java/ABAP). We have deployed the Java Component B2B and use the XCM based Internet Sales webshop from the mySAP Business Suite 2005 SR1 Java CD (51031807). The ISA session logs works correct

  • Suppliers Aging Report layouts - Date in US format

    Hi all I am running the above layout.  The Date field for the document date is a system variable but it displays as US format.  How do I get it to display UK?  Thanks! Lorna

  • WLC-Radius Integration..

    Hi I want to do the WLC authentication with radius.the problem is when i enter the username and password , in radius it shows authentication passed but in telnet prompt it asks again for username password as if wrong username-password. attached are d

  • Oracle Text Search for UCM on Standard One

    I'm curious if OracleTextSearch Component for UCM would work with 11g Standard One (or if there are any limitations running UCM with Standard One). Any experiences out there - as this would be for primarily smaller instances?

  • I am selling my iPad 3, how do I restore to factory settings

    How do I restore my iPad 3 to original settings.  I purchased iPad Air, and am selling iPad 3.  thanks for your help.