SubReport Data in a Main Report Yet Again

I have been trying and reading posts all day.
1. The shared variable formula used in the main report will show any/correct value only if its placed atleast 1 section below the one where the sub report exists. (I've Done This)
2.The formula that is used inside the sub report needs to be physically placed on any of the sections within that sub report(you can suppress it to avoid displaying the value). (I've Done This)
3. Due to design constraints if you cannot move the sub reports from Report Footer then you can atleast mock them and place respective copies in the Report Header.These can contain just the summary values, thats it. Further, to nullify the display effect you can suppress all the sections of these sub reports and make them so small such that they appear as tiny dots and place them in extreme corners of the Report Header section. (Not sure this would apply since I have met #1 and #2)??
The blue outline/highlight is the passed total from by first subreport locatd in Group Header 1b. As you can see it is passing 0.
In the subreport, here is the formula used to get the OrderQty.
WhilePrintingRecords;
Shared NumberVar OrderQty;
OrderQty := OrderQty + {iptrn.ipqord}
I am using the "three part" formula to to calculate the Qty because when using a sum it sums up all records and I need to to sum by change in item. The subreport is calculating correctly. I have also tried a running sum but this won't pass either and I get messages about not being able to use the formula with itself so gave up that avenue.
In the main report, here is the formula used to display the OrderQty.
WhilePrintingRecords;
Shared NumberVar OrderQty;
OrderQty
//@MainFormula
//Returns the value that was stored in the shared number variable called
//OrderQty in the subreport
I think I have this all correct but still getting zero so i am not sure if it has something to do with resetting the value and maybe my linkages are not correct? Any help will be appreciated. I have very little experience with Crystal and less with sub reports.

Ok, so I used the example sent and I can't really tell you why it worked but it did. The modifications I made were so minor I would never have expected it to work.
here is one
Mine
WhilePrintingRecords;
Shared NumberVar OrderQty;
OrderQty := OrderQty + {iptrn.ipqord};
Yours
whileprintingrecords;
shared numbervar OrderQty;
OrderQty:=OrderQty + {iptrn_.ipqord}
The only difference I see other than the capitalization is the space after OrderQty :=.  My numbers were working fine on the sub report, they just wouldn't pass to the main report.  I did move the reset to the page header like your example but I don't understand why that even works when it should reset on the item, not the page..??? I also put the details variable in a second detail section like you had in the example. What is the theory behind this?
I also had a second one that I needed so I set that up exactly as the first one and no go. I had to move the reset into the GH1 and I put the details variable in a second detail section and it too worked.
I can't say that I understand why......I'm happy it works but it would be nice to know the why so next time I wouldn't struggle with it

Similar Messages

  • After changing a subreport I loose data in the main report.

    Hi All,
    I have a main report that has two parameter fields and two subreports linked to the parameter fields.  The two subreports access the database and work fine separately.  When I add the two subreports to the main report it works fine.  As soon as I make a change to a subreport it works fine standalone.  But as soon as I update the main report (reimport subreport) the subreport no longer returns data to the main report.  To get the report to work after a change to a subreport I have to delete the subreport from main and then add it back in again.
    Does anyone have any suggestions?
    I am using Crystal Reports 10 and I'm totally at my wits end.  I've been working with Crystal for about 5 years and this is the first time I've seen this.  Maybe I'm missing something small but I just can't seem to find the answer.
    Thanks for any help,
    Jim

    Jim:
    I usually edit my subreports from within the main report.  I right click the subreport and then click edit subreport.  This eliminates the need to reimport the subreport.  I've done a lot of work with subreports and this always works for me.
    I hope this is not too late and helps you out.
    Ralph

  • Supress details in subreport based on date ranges in main report

    I am using Crystal XI R2 and am working with Human Resources Data.
    The main report is grouped on and generates a list of temporary teaching positions like this:
    Smith, John
         FTE_____Start Date_______End Date
          .3 ______09/01/2007______10/20/2007
          .2 ______10/05/2007 ______04/15/2008
          .2 ______04/01/2008 ______06/30/2008
    The subreport (generated from a different source, but linked to main report on ) generates a list of days the employee worked as a Teacher on Call:
         TOC Date______ Portion of Day Worked
         09/05/2007______1.0
         09/19/2007______0.6
         10/08/2007______0.4
         10/09/2007______1.0
          04/08/2008______0.6
          04/18/2008______1.0
    Employees are granted seniority for TOC days worked, EXCEPT when they are already employed in a Teaching position >=.4 FTE  (because they are already granted full seniority for that period), so I need to be able to suppress records that fall within date ranges listed in the Main Report where the combine FTE is >=.4.     
    I believe this question has two parts:
    1. how do I evaluate the date ranges to combine overlapping periods?  Results would look like this... (I don't need to be able to see this, but I'm assuming I'd have to create a date range with the results in order to answer question #2 - but I haven't worked much with ranges.)
        FTE_____Start Date______End Date
          .3______09/01/2007______10/04/2007
          .5______10/05/2007______10/20/2007 
          .2______10/21/2007______03/31/2008
          .4______04/01/2008______04/15/2008
          .2______04/16/2008______06/30/2008
    2. how do I supress the TOC dates in the Subreport that fall within the start and end dates of all the employee's positions >= 0.4 FTE ?  Supreport results for this example would look like this...
         TOC Date______ Portion of Day Worked
         09/05/2007______1.0
         09/19/2007______0.6
         04/18/2008______1.0
    (I will sum the "portion" values and mulitply them by a constant variable to complete the seniority calculation.)
    Thank you in advance for any assistance you may be able to provide!

    Thanks for your help Graham, I have continued to work with this and I took the BO Crystal III course.  Your suggestions gave me a sense of  direction.
    I was not able to share a date range array with the subreport (kept getting error messages saying "call BO" , but I WAS able to share the startdate array and the enddate array.  I also shared the fte values array. 
    I had wanted to use a loop  to check
    if TOCdate in startarray[x] to endarray[x]
    then ftearray[x]
    and  sum the new range of fte[x] values so that I could suppress any TOCdates where fte was >=0.4.   But I couldn't quite get there, I kept coming up with formulas that displayed only the first value or the last or zero.
    So I used the following formula for each index (returnindex value had to be changed for each case), then added them all together.
    shared datevar array startArray;
    shared datevar array endArray;
    shared numbervar array FTEArray;
    local numbervar arraylength:= ubound(startArray);
    local numbervar i;
    local numbervar returnindex :=-1;
    If arraylength >=1 then
    if not({AAATDDET.Date} in startarray[1]to endarray[1])then
    0 else
    if {AAATDDET.Date} in startarray[1]to endarray[1] then
    (returnIndex:= i;);
    i:=i+1;
    if returnindex =0 then
    ftearray[1]

  • Multiple subreports within a single main report?

    I'm a newbie to BI Publisher, but have used Crystal Reports quite a lot.
    I have a requirement which essentially consists of a set of 7 similar and closely related reports, each using a different SQL Select statement and printing different columns; the user will have the option of selecting either one of the 7, or all of them.
    In Crystal Reports I would set up 7 subreports within a single main report, and depending on the parameter, suppress those subreports which are not required.
    Is there a technique within BI Publisher which would enable me to achieve the same thing?

    all the sub templates will go against a single XML. So if your sub reports in CR is handling different query, you need to take a step back and think of separating data and layout. So multiple queries will be handled by data templates. So, for example, if your main report fetches some records as Q1 query, and you have two sub templates with queries as SQ1, SQ2 (linked subreport). Then we have to see what relationship exists between the main report and the subreport. Say, the sub report query creates a relationship with the Main report data, to filter certain records. So this can be achieved in data template using Q1 and SQ1 using bind relationship, ie, Q1 is master query and SQ1 is a detail query. Similarly Q1 and SQ2 relationship can be established. The datatemplate when executed, will fetch a single XML data.So in this case you do not need sub template. The sub-report layout is not separate, and is to be created with the main report.
    In case of unlinked subreport, the content of subreport is independent of main report, so you can simply define two datasets in BI Publisher and then select the Concatenation option. So the final XML data will be a concatenation of two XML data. The main report can read data of the main XML and the sub template can read data from the appended XML data. This can be done using xPath.

  • How To Pass Data Between A Main Report and a Subreport

    Hello,
      I'm working with Crystal Reports Professional XI. 
      I have a main report with two date parameters: BeginDate of Date type and EndDate of Data type.  The main report has no details being printed instead it's grouped by a formula field and displays a summary count at the group footer.  I have  a subreport that is not linkable to the main report.  The subreport is grouped differently.  It has no detail records being printed and displays a summary count at the group footer as well.  The two reports are using the same tables with the same linking relationship.
       I created the same two date parameters in the subreport but this isn't right because when I run the report then I get four Date prompts: BeginDate and EndDate parameter from the main report and the BeginDate and EndDate parameter from the subreport.
      I'm not dong something right here.  What do I need to change in the reports so that l have the same record selecton being passed from the main report to the subreport record selection based on the BeginDate parameter and the End Date parameter from the main report?  Right now, the subreport is selecting all the records in the tables specified.
      Have a great day.  Any feedback would be greatly appreciated.
    Thanks,
    Ting

    Hi Jason,
       Thanks for replying to my posting.  It's been awhile since I've worked on Crystal Reports so I'm getting reacquainted with sub-reports again.  
        By linking the main report to the subreport by the BeginDate and BeginEnd parameters, will the date parameters be passed from the main report to the record selection for the subreport?  
       Also by doing your approach when the user is prompted to run the report, will it display on the popup window four date parameters: the BeginDate and EndDate from the main report and underneath that the BeginDate and EndDate from the sub report?  If so I'm trying to avoid that because it would be the same date range that I'm wanting to use for the main report and the subreport.  
        I hope that made sense.
    Thanks,
    Ting

  • Not having to refresh the data in the main report but only in the subreport

    Hi SAP,
    I have a report that uses a stored procedure in the main report and uses regular database tables in the subreport.  The data returned from the stored procedure reports information from the month-end database (a cutoff point from the previous month's numbers) while the subreport reports information from the live database.  This report gets run everyday to show the changes in numbers from the live database.  Obviously the numbers from the month-end database remainds static until the next month's cutoff database is created. 
    My problem is that everyday when I run the report, the data needs to refresh from both the stored procedure in the main report and the live database tables in the subreport.  How can I leave the data returned from the stored procedure static or as is without refreshing the stored procedure returned data and just have the subreport data refresh itself?  The stored procedure really puts a strain on the database and I would like to cut-out the time to process the report as well.  Does anyone have any ideas?
    Zack

    Hi Zack,
    Try the following under Report options.
    1. Clear the check box of "Verify Stored Procedures on First Refresh" in the Main report.
    2. Select the check box of "Verify on First Refresh" in  the sub report.
    Hope this helps.

  • 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

  • Using a subreport formula in a main report formula

    Hello,
    I am trying to use a formula that is in the subreport and also a formula that is in my main report to come up with a percentage.
    ve researched the forums on the internet and couldn't find anything that directly fit my situation.
    - Formula #1: The SubReport formula is the "sum" of a number variable of {JobRecord.ProjectedIssueDate}. This is for the actual amount of job issued.
    - Formula # 2: The MainReport formula is the "sum" of a number variable of {JobHours.StartDate}. This is for the actual amount of jobs completed.
    Issue: I need to create a formula to take the Formula # 1 and Formula # 2 and get a percentage.
    Example:
    9 Jobs Completed in Main Report / 10 Jobs Projected in Sub Report = 90%
    My main report is grouped as follows for both the main and sub report:
    Grouping #1: Start Date
    Grouping #2: Contractor Code
    Grouping #3: Job Type Code
    I need this formula to work on the Grouping # 3 Level.
    Any takers?

    Also, If you want the Percentage and Sum from the Subreport to show beside each other, here's what you need to do:
    1) Create a new Group header 3b section
    2) Move everything except the Subreport on the Group Header 3b section
    3) Get inside the Subreport and suppress all sections of the Subreport
    4) Back in the Main Report reduce the size of this Subreport and make this no bigger than a dot. Reduce the size of the section so it doesn't take up a lot of space.
    5) Create a formula with this code:
    shared numbervar cnt;
    Drag and drop this formula on the Group header 3b so that this shows the sum from the Subreport.
    -Abhilash

  • Issues once subreport is added to main report.

    Another question from a new Crystal Reports Developer. I have been battling this one for multiple days. I have built two seperate reports through Crystal Reports that pull their data through an ODBC connection from Remedy ITSM. One report is pulling data through the table AST_AssetPeople. It is pulling the following fields: Asset_ID and Full_Name. The other report is pulling data from the AST_ComputerSystem table showing the following: Name, Category, Type, Item, Model_Number, Serial_Number. I am using the AssetPeople report as the main and the ComputerSystem report as the subreport. When I pull the ComputerSystems report into the AssetPeople report as a subreport, my CR lags very badly. I let CR attempt to pull the data for about 2 hours before I left work the other day and ended up having to leave it overnight. When I came back to work the following day it had finally completed and I was able to view all pages of data. This is with the subreport being added to the details section of my main report. I had sent it to someone else at work that has Crystal Reports on their PC and they were able to run it just fine and it only took a few minutes to get all pages of the data back and viewable. That lead me to think that it was my PC, but when I went over to the other persons PC and logged in with my profile, I had the same problem that I had on my PC. This leads me to believe that it is an issue with the settings. The other person is out for the next week so I cannot verify that my settings match his, so I was wondering if anyone on here might have an idea what may be causing the issues that I am having. Both reports run just fine on their own, as do all my other reports that are simple reports from one table. It is just when I try to pull in a subreport that I have this issue. Any help would be greatly appreciated.

    I have gone in and checked the box next to Perform Grouping on Server. The check box next to Use Index or Servers for Speed was already checked. The Links for the subreport are set up as follows.
    For subreport: Supported vs. Unsupported (This one comes from the ComputerSystem table)
    Container Report fields to link to: AST_AssetPeople.Asset_ID
    AS_AssetPeople.Asset_ID field link-
    Subreport parameter field to use: ?Pm-AST_AssetPeople.Asset_ID_
    Select data in subreport based on field: AST_ComputerSystem.Asset_ID_
    Asset ID is the only field that I found that the two tables have in common. I believe that I have the links set up correctly, but I could be wrong.
    Either way, I am still having the same problems.

  • Crystalrep:how to use the summary of subreport to calculate in main report

    mainreport  main  main  sub      sub   main
    Salesman      sales    Cost   Travel   Taxi   Margin
    A1             100       50       20       20     sales-cost-travel-Taxi
    A2             200       100     20       20     sales-cost-travel-Taxi
    A3             300       200     40       30     sales-cost-travel-Taxi
    eg.: A1 margin=100-50-20-20=10
    main report linked to subreport by salesman and confirmed the data in report is correct. but the summary of travel and taxi is from subreport, if i want to calculate the margin, the travel and taxi can not be insert to the formula, only sales and cost can be calculated
    how can i process travel and taxi ?

    If you search the kbases (articles) for "c2007600" or "how to share subreport data with main report" you'll find what you need.
    NOTE:  One can NOT use data from a subreport object in a section in the main report that is previous to the section in which said subreport is located.

  • Using a subreport field in a main report formula.

    Post Author: testing123
    CA Forum: Formula
    Hi.I have a summary of a field {timesheet_log.labour_cost} in a subreport and a field {project.total_po} in the main report and I want to add the two together in a function in the main report. Both fields are linked to a job which is grouped by the jobs' ID.The subreport contains this formula: shared CurrencyVar myTotal;myTotal := Sum ({timesheet_log.labour_cost}); In the main report I have a formula, myTotal, that reads: WhilePrintingRecords;shared CurrencyVar myTotal;myTotal;  As you can see myTotal is a shared variable which contains the total of all the values in {timesheet_log.labour_cost}. However, when I put the formula myTotal in the group footer for each project, it will only change if there is an actual set of values in {timesheet_log.labour_cost}. If there isn't, it will display the last total of {timesheet_log.labour_cost}. We get something like this: Job           Sum{timesheet_log.labour_cost}           {project.total_po} 10050       0   (no value)                                                  100       10051        400    (Value = 400)                                    492210052        400    (no value)                                              32910053      400   (no value)                                    1111110054      2490 (Value = 2490)                                     24210056      6000 (Value = 6000)                            343410057      6000 (no value)                                    99494 Basically what this is saying is that if there are no values at all (ie NULL) in {timesheet_log.labour_cost}, the formula I have made will use the previous value. What I want to do is set the Sum({timesheet_log.labour_cost}) to zero if there are no labour_costs so that basically the value is reset to 0 if there's nothing there.                           

    Post Author: JKitz
    CA Forum: Formula
    Group it by Job Number and then add the following to the group header:  WhilePrintingRecords;shared CurrencyVar myTotal := 0 Then put the information you have above in the group footer with your formula and suppress the detail section.  That way you will zero it out with each new Job Number

  • Display Subreport Totals in the Main Report

    I am using CF10 Report Builder. I have a main report that show counts/amounts by award type for admitted and deposited students. I have a sub report that shows counts/amounts by award type and level for current students who have registered and those who have not yet registered. I need to show the totals of current students by level and weather they have registered or not.
    I tried adding a sub report to show the totals but the sub report does not show up on the main report. Is there a way to do this that I am missing?

    I created the sub-report because the award information is kept in separate
    tables for incoming and returning students. I will work on combining the
    the two.
    Thanks
        Bonni
    Bonni Harris
    Database Analyst
    Eureka College
    300 E. College Avenue
    Eureka, IL 61530-1500
    309-467-6467
    On Tue, Apr 28, 2015 at 12:25 PM, EddieLotter <[email protected]>

  • Behavior on subreport totals in the main report

    I have a grouped report which receives two totals from each grouping's subreport via shared variables.  In the main report I show the subreport totals for each group but cannot find a way, in the main report, to add the subreport totals together to become a report grand total.  The running totals feature does not see the returned subreport totals and I cannot find a formulaic way of achieving a grand total.  Has anyone managed this?  Any help is much appreciated.

    Lets step back a moment and see, you got Sub report places in say GF1 section. I suppose this formula of SV in the sub report is placed in the RF of the sub-report right ? what you might have to do is Change the sub report SV to assign it to a Running total...
    The subreport SV is:
    WhilePrintingRecords;
    Shared CurrencyVar
    AmountSpentRunningTot := #RTOTAL0 ({QuoteMaterials.qmmMinimumCharge})
    **You might have to create a separate SharedVariable with some different name, place it in the RF of the SUBreport
    Now I am guessing that this sub report repeats N times..for N number of GF in the main report...you might have to make a manual running total where you capture and add the 'GrandRunningTotal' coming from Sub report in every GF of the main report and then display it in the main report(s) RF...
    hope i made sense...its little complicated to put it out in words...

  • Value in the subreport used by the main report?

    How do I make so that a value in the sub-report can be used by the main report? Is there a way to make the subreport values "global"?
    I am working from an older version of Crystal. Please let me know if this is self-explanatory in the newer versions.
    Esther

    Hi,
    You can create a shared variable and assign the value to that in the sub report and same can be used in main report.
    For more info on how to use shared variables, please check this under section Shared variables.
    Thanks,
    Raghavendra

  • Hi ,Multiple SubReport parameter  in one main Report

    Hi,
    I using one main report in that five to six sub report and each sub report have two parameter fromdate and todate so please guide me how can i pass using coding.
    Regards
    Rajkumar Gupta

    Hi
    Please post your query in the SDK development forum.
    Follow the link below:
    https://www.sdn.sap.com/irj/sdn/businessobjects-sdk-forums
    Thanks

Maybe you are looking for