Totaling 2 subreports

In Crystal  11 I have 2 sub reports containing totals.Is there a way to total both of those totals and place in main report?
DZ

declare shared variables in the resepective subreports to store the total. once you declare them then create two formulas in main report and assgin those shared variables to those formulas the syntax would be as follows
in subreport 1
First formula  would be "initval", here u declare a shared variable and keep in page header, so that it will be initated to 0 each time
initval (syntax is as follows)
shared numbervar tot1 :=0;
second  formula is for "total1"
syntax for this formula would be as follows
shared numbervar tot1 := shared numbervar tot1 + table1.amount (this is field which u want the total)
in subreport 2
formula one would be again  "initval" here u declare a shared variable and keep in page header, so that it will be initated to 0 each time
initval (syntax is as follows)
shared numbervar tot2 :=0;
Second  formula would be for "total2"
syntax for this formula would be as follows
shared numbervar tot2 := shared numbervar tot2 + table1.amount (this is field which u want the total)
now in main report
first formula is " totsub1"
syntax would be as follows
shared numbervar tot1;
second formula is " totsub2"
syntax would be as follows
shared numbervar tot2;
now you create one  more formual for tot1+tot2
you will get total from both the sub report.
If u have  any queires please get back to me.

Similar Messages

  • Totaling subreport data on each page

    I have 5 subreports linked to the main report all based on Employee ID.  They each pass their data via a shared variable.  The data is being passed to the main report without a problem.  When I try to total each page (one per employee), I am not getting the correct total when there is a blank value for one of the subreports.  If the value should be 0, the subreport is still holding the value from the previous employee, and adding that into the total - even though it is not displaying a total.
    Is there a way to clear the shared variable for each page (employee).  I have tried putting a reset in the page footer, but it doesn't seem to work.  I have also tried putting a reset variable in the header of the subreport - that also didn't work.
    My subreports are currently located in the details section of the main report.  My report total (on each page) is located in the details b section, along with the shared variables that bring the totals from the subs.
    How can I get the shared variables cleared after the totaling of each page?  I'm using Crystal 2008, and I'm stumped!

    Hi Raghavendra,
    I'm not sure I understand about creating a fake group?  I did try to insert a group in the subreport, and selected to have it repeat the group header on each page.  I then put a reset in the group header.  I also suppressed the group header, but it is still not clearing the shared variable in the main report. 
    Did I create the "fake group" correctly?
    The value returned by the sub is correct (I get 0.00 when applicable), but that shared variable in the main report continues to hold the previous value until replaced with a value other than 0.00.
    Thanks in advance for your help!
    Laurie

  • How to show a Page Total in a Main Report that is calculated in a SubReport

    Hi,
    I have a Main Report and a SubReport with the detail.
    The Report has several pages. I want to show a Page Total in each Page, retrieving data that is in the subreport (Detail).
    I tried to use a shared variable, but the problem is that the formula fields are assigned at the end of the subreport, so I can't pass the value back (to the main report) until the last record of the subreport is printed.
    I also can't show the Page Total at the subreport, because I have a particular format that I need to respect and only can be printed from the Main Report.
    Is any way to do this ? At this moment, with the shared variables I'm getting 0 until the last record is printed.
    Also, I can calculate the Page Total from outside Crystal Reports, do to there some fields that can grow, so I can't figure out how many record are going to be printed.
    Thanks in advance!
    Ariel

    hello, this may depend on how the main report was actually paging...
    1) do you have one group per page for example?
    2) is the sub on a group footer level?
    3) does the subreport use a different data set than the main report?
    some suggested workarounds would be to
    a) use a report header cross-tab (identical to the existing crosstab) that creates an array of values that you can access anywhere on the main report
    b) place an identical cross-tab above the existing one, and suppress all of the subreport sections (not the section where the subreport sits) and then bring the value back to the main report
    cheers,
    jamie

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

  • Subreport totals are not displayed correctly in Preview

    I'm using Crystal Reports 2008.  I have a subreport that sorts hiearchically.  It is placed in the Report Header of the main report.  Within the subreport, it has calculated totals for each hiearchy grouping.  When ran, those totals are incorrectly displayed in the Preview;  however, when I click on the subreport, those totals are displayed correctly in the preview of the subreport.  Also,  if I go to the subreport design, pretending I'm editing the subreport, then go back to the main report preview, those totals are correct.
    Has anyone experienced this issue?  Please provide help/advise.  Thanks.

    Shwu, The subreport does not process any value based on the main report. I also observed that if the group extends to next page, the totals are incorrectly displayed.  I have both 'Keep Group Together' and section 'Keep Together' selected, but still the data extends to next page.  The subreport is sorted with 'Hierarchical Grouping'.  For example, below 2 lines are printed at bottom of a page:
    North America
        Sales department
    then Crystal prints the rest of departments belong to North America onto next page as:
         Marketing
         Consumer
             Government
             etc.
    I was hoping if I could get Crystal to not print the group if there's not enough space on the page, but rather print on next new page, the incorrect totals would go away.  Any idea how I would do page break for hierarchical groupings?

  • Use subreport total in formula in main report

    Hi,
    I have a subreport which is a total figure. I just want to muliply this by a number in a field on the main report, can this be done?
    Any help appreciated!

    Symptom
    A report contains a subreport. Data from the subreport is required for calculations in the main report.
    How can you share subreport data with the main report in version 7 (or higher) of the Crystal Reports Designer?
    Resolution
    Shared variables, introduced in Crystal Reports version 7, make it easier to pass values from a subreport to the main report. Using shared variables requires two formulas: one to store the value in a shared variable, the other to retrieve the value from the shared variable.
    The most important thing to remember when using shared variables is that Crystal Reports must first evaluate the formula where the value is stored before evaluating the formula that retrieves the shared variable.
    For example if you want to pass a grand total from the subreport to do a calculation in the main report, follow these steps:
    1. In the subreport, create a formula similar to the one below:
    //@SubFormula
    //Stores the grand total of the
    //{Orders.Order Amount} field
    //in a currency variable called 'myTotal'
    WhilePrintingRecords;
    Shared CurrencyVar myTotal := Sum ({Orders.Order Amount})
    2. Place this formula in your subreport.
    3. In the main report, create a formula that declares the same variable name:
    //@MainFormula
    //Returns the value that was stored
    //in the shared currency variable called
    //myTotal in the subreport
    WhilePrintingRecords;
    Shared CurrencyVar myTotal;
    myTotal
    4. Place @MainFormula in a main report section that is beneath the section containing the subreport.
    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.
    One way to do this is to insert a section below the section containing the subreport, and place @MainFormula in this new sub-section:
    · On the 'Format' menu, click 'Section'.
    · On the 'Sections' list, click the section containing the subreport.
    · Click 'Insert' (at top of dialog box). This inserts an additional subsection.
    · Click 'OK' to return to the report, and insert @MainFormula into this new sub-section.
    The next time you preview the report, @MainFormula displays the value from the subreport. In this particular example, that value was the grand total of the {Orders.Order Amount} field.
    ============
    5. Once you have verified that @MainFormula is returning the correct value from the subreport, you can include this formula in other main report formulas, such as:
    //@NewFormula
    //includes data from subreport
    {@MainFormula}+ Sum ({Customer.Last Year's Sales})
    · Place this formula in the same section as @MainFormula, or in a section further down on the report.
    You have now successfully shared data from a subreport with the main report.
    NOTE: =====
    This is not possible with On Demand Subreports in Crystal Reports.

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

  • Cumulative running total thru a subreport

    I have a simple main report that returns customer contact detail info with a count of those customer contacts. The report is grouped by "Mailing Type" of which there are 5 for this particular process.  After each group, I have a sub report returning contact detail but this time for prospects associated to the same mailing type, thus resulting in 2 different counts of contacts for each mailing type, one for customer and one for prospect contacts.
    I want to create a "running total" that will show the total number of contacts for each mailing type
    So, if there are 10 customer contacts and 2 for prospects associated to type 1, I want to show 10 at the end of the customer group, then 12 at the end of the prospect sub reprort, then accumulate the next set of custoemr contacts and then the next set of prospect contacts thru to completion.
    I've setup shared variable for totalcustomercontact and prospectcontact counts, but these variables seem to reset in each group as opposed to accumulate, so I'm certainly doing something wrong.
    Seems like a common need that I'm just run across for the first time, so I would appreciate any assistance. 
    Thank you,

    To produce your running total:
    Create a formula called something like runnitn_total as
    numbervar totalcount := totalcount + (the count of the group field(s) you're totaling).
    Put it in your Report Footer but also put it in the Group Footer where your current subtotals are (you can suppress the one int the Group Footer.
    This should give you the totals you're looking for.
    EG formula field totnum contains "numbervar totalnum := totalnum + Count ({@num_key}, {@firstnum})"
    put totnum in the group footer and report footer.
    suppress the one in group footer.

  • Report with Subreport - Summary Table On First or Last Page

    Post Author: andbort
    CA Forum: General
    All-
    My apologies in advance for the long post. I would like to know if something can be done in a single report instead of having to spread it across two reports. I will use generic (Xtreme sample database) field names to explain my dilemma. I currently have the following report:
    Main Report
    Customer ID, Customer Name
    Subreport
    Order ID, Order Amount, Customer ID
    Each Customer and its associated subreport are displayed on a separate page. So it looks like this:
    (first page)
    1 City Cyclists
    100    $200    1
    101    $5000  1
    102    $350    1
    (second page)
    2 Pathfinders
    103    $760    2
    104    $20      2
    (third page)
    3 Bike-A-Holics Anonymous
    105    $120    3
    106    $270    3
    107    $400    3
    And so on. This report often has numerous customers (i.e. ~10 or more customers, thus ~10 or more pages). The business users would like to have a "summary" page at the beginning of the report. This summary page would be in basic tabular format, with one row per customer, but each row would contain values from the subreport. So the updated report would look like this:
    (first page)
    Customer ID       Customer Name                        Most Recent Order Amount
    1                       City Cyclists                             $350
    2                        Pathfinders                              $20
    3                        Bike-A-Holics Anonymous        $400
    (second page)
    1 City Cyclists
    100    $200    1
    101    $5000  1
    102    $350    1
    (third page)
    2 Pathfinders
    103    $760    2
    104    $20      2
    (fourth page)
    3 Bike-A-Holics Anonymous
    105    $120    3
    106    $270    3
    107    $400    3
    Is this possible in Crystal Reports 10?
    Additional Background: The application in question is ASP.Net 1.1 (Visual Studio 2003) which displays reports designed in Crystal Reports 10. The actual report displays customer records in the detail section Da. There are 5 subreports, one in each section Da, Db, Dc, Dd, and De. The summary page could be rendered either at the beginning of the report (e.g. report header) or at the end (e.g. report footer), but will ultimately need to contain Customer table field values, as well as field values from two of the five subreports. I am hoping that this requirement can be addressed in a single report, instead of having to spread it across two reports (each displayed in its own CrystaReportViewer control on the web page). I am assuming that a solution to the generic example above will be applicable to my specific report.
    Thanks,
    Andrew Bort
    National Grid
    [email protected]

    Post Author: Guy
    CA Forum: General
    Hi,
    If I understand you correctly, you could simply use a crosstab at the begginning of your report to summarize all customers.  If you put it alone in its section you'll be able to specify that you want a page break after.
    The remaining of the report should be a simple report where you group on your customer and the detail line showing a sale.
    finally, if I was wrong above and you still need subreports, you can use a shared variable (or a parameter) to allow the main report to receive the total from the subreport.
    Good luck!

  • Supress Group Header in Report when Subreport is blank

    well the title says it all.
    I want to supress the main report group header when the subreport (is in details) is blank.
    I'm stuck on this:
    I'v created a shared variable in both report and subreport and it gives me the number I want but not where I wanted to appear. If I put the variable on the group footer it shows me the correct value but if I put it in the group header it shows me the previous group footer result.
    This is what I got:
    Group Header
    Client 1
    Shared Variable=0
    Details
    Contract 01
    Contract 02
    Group Footer
    Shared Variable=2
    Group Header
    Client 2
    Shared Variable=2
    Details
    Group Footer
    Shared Variable=0
    This is what I want:
    Group Header
    Client 1
    Shared Variable=2
    Details
    Contract 01
    Contract 02
    Group Footer
    Shared Variable=2
    Group Header
    Client 2
    Shared Variable=0
    Details
    Group Footer
    Shared Variable=0
    Can I do that?
    Edited by: Pedro Pinto on Jul 29, 2008 2:47 PM

    I'm going to try my best. This is what I get:
    Main Report
    Group Header
    Client 01   --    0->shared variable
    Details
    Subreport 1
    Group Footer
    2->Shared Variable
    In subreport for client 01:
    Detailsa
    Contract 01
    Contract 02
    Detailsb
    Total of contracts = 2->Shared Variable
    Main Report
    Group Header (supress this section)
    Client 02   --    2->shared variable
    Details
    Subreport 1
    Group Footer
    0->Shared Variable
    In subreport for client 02:
    Detailsa
    Detailsb
    Total of contracts = 0->Shared Variable
    For Client 03 it doesn't show anything but if Client 04 if it has contracts it only shows the contracts but not the name of the client.
    I've already did supress when is blank but in the details.

  • Subreport linking problem after upgrading to JRC 2.0

    Here's a little background of my environment before I get to the problem.  We have a suite of reports that were developed with CR4E ~v1.04 in Eclipse 3.3.1.  I only used the plugin for setting up the pojo data sources and then did the report development in the standalone Crystal Reports Designer XI, and would then import the report back into Eclipse.
    This week I installed the new 2.0 runtime jars and also update the eclipse plugin to version 1.07(we aren't in Eclipse 3.4 yet).  We have a few reports with multiple subreports for things such as agent totals, weekly totals etc.  A report layout might look like this.
    Agent 1
         Day1 info
         Day2 info
         Day3 info
         Agent 1 Total  (this would be a subreport)
    Agent 2
         Day1 info
         Day2 info
         Day3 info
         Agent 2 Total   (this would be a subreport)
    After the upgrade, when a report is generated, the subreports only work the first time they appear in the report.  So in the above example, 'Agent 1 Total' would be normal, but 'Agent 2 Total' would have no data.  Any non data related formatting will show up, so the subreport is there, it's just not able to get the right data from the subreport links.  I have verified the data is there both by debugging the services(which haven't changed) and removing the subreport links, thus having all the data show up for each subreport.  The fields that are used to link from the main report to the subreport have the correct value at the time the subreport is used.  I have tried both regular pojo fields and formulas fields to link the subreports, and the problem happens either way.  Please advise.
    Thanks,
    Cameron

    Similar problem from old version to new version(there isn't change in the changeDataSource method..): same report with 1 subreport in old version work well but with new version there is that error:
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKParameterFieldException: InternalFormatterException---- Error code:-2147217394 Error code name:missingParameterValueError
         at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.if(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
         at report.CRJ12.main
    i've use log4j to have better information about the error (that is the first part of the log)
    ERROR [main] (?:?) - Failed to load the resource 'InternalFormatterException' from the bundle java.util.PropertyResourceBundle@1cbf6bb.
    java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key InternalFormatterException
         at java.util.ResourceBundle.getObject(Unknown Source)
         at java.util.ResourceBundle.getObject(Unknown Source)
         at java.util.ResourceBundle.getString(Unknown Source)
         at com.crystaldecisions.reports.common.CrystalResources.loadString(Unknown Source)
         at com.crystaldecisions.reports.common.CrystalResources.loadMessage(Unknown Source)
         at com.crystaldecisions.reports.common.CrystalResourcesFactory.getLocalizedMessage(Unknown Source)
         at com.crystaldecisions.reports.common.CrystalException.getLocalizedMessage(Unknown Source)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(Unknown Source)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(Unknown Source)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(Unknown Source)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(Unknown Source)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(Unknown Source)
         at com.crystaldecisions.reports.common.ThreadGuard.syncExecute(Unknown Source)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.for(Unknown Source)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.int(Unknown Source)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
         at com.businessobjects.sdk.erom.jrc.a.a(Unknown Source)
         at com.businessobjects.sdk.erom.jrc.a.execute(Unknown Source)
         at com.crystaldecisions.proxy.remoteagent.RemoteAgent$a.execute(Unknown Source)
         at com.crystaldecisions.proxy.remoteagent.CommunicationChannel.a(Unknown Source)
         at com.crystaldecisions.proxy.remoteagent.RemoteAgent.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ds.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.if(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
         at report.CRJ12.main(CRJ12.java:442)
    Edited by: Andrea Bonf on Feb 13, 2009 10:14 AM

  • Crystal Report / Subreport - Performance Issue

    I am having problems with a Crystal Report / Subreport with performance. I am using Crystal Version 11, directly in Crystal Developer.  There are no other programs involved.  I am linking to a SQL Server database using ODBC.
    I have narrowed the problem down to this:
    The main report has 4 tables.  See diagram using the following link.   http://screencast.com/t/TA9YYlwwl7
    The subreport has 1 table, this table has > 2 Million records in it.
    The main report links to the subreport with one field:
    Main report field SAMPLE.PATIENT = subreport field Z_RESULT_HISTORY.PHIN
    When I set the subreport linking within Crystal   it automatically generates the following in the record selection for the subreport:
    {Z_RESULT_HISTORY.PHIN} = {?Pm-SAMPLE.PATIENT}
    The problem is that the report execution time is dependent on the field that I am using for the record selection in the main report.
    Case I   works lightening fast:
    There are 16 records returned on the Main Report   each one of these has about 1-5 records returned on the subreport.
    {SAMPLE.PATIENT} = "MOUSEMICKEY"  and {SAMPLE.SAMPLE_NUMBER} < 200
    Case II   brutally slow   there are 51 records in the main report that qualify   with a few records each in the subreport.  By  brutally slow    I mean a few minutes:
    {BATCH.NAME} = "HEP_ARCH-20090420-1"
    In this case, I can see in the bottom right of the Crystal Preview window, that it is reading through all 2M records in the Z_RESULT_HISTORY table
    Case III   brutally slow - a couple minutes
    {BATCH_OBJECTS.OBJECT_ID} = 111
    This returns 1 record on the main report and 0 records on the subreport.  Yet I can see it reading through ALL 2 Million records before the report is displayed.
    What I can t understand is why the field used for record selection on the MAIN report is affecting the speed of the execution of the subreport.  I need the main report to be selected by BATCH.NAME   yet I can t figure out what I can change to make the report run fast.  When I record select the main report by SAMPLE.PATIENT, I do NOT see the subreport reading all 2M reocrds - the report preview is returned in less than 1 second.
    Any help would be much appreciated.

    Lindell - your response was very helpful.  I was able to create a SQL Command on the subreport and change the subreport links on the main report to use the paramters in the SQL Command.  The report is now very fast - even when there are lots of detail records on the main report.  It is properly executing the query and not reading all 2M records into memory for each subreport.
    I'm still totally confused as to why Crystal was misbehaving so poorly and changing how the subreport queried the database when the only change was the fields used for record selection on the main report.  It really looks like a bug to me, but maybe someone can still enlighten me.
    thanks again so much.  We are in Parallel testing for a production rollout - and the users are MUCH happier now!  (which of course makes me much happier!)
    Susan
    PS I was not aware of the SQL Command - had never used it before.  Took me a little while to figure it out and how to do the linking - but it is very powerful.  Thanks again.

  • How to get total,maximum,mimumum no. of cases for this report

    Description:     Reason For Contact For Customer - This report will provide the total number of cases created for a particular Reason For Contact for a particular Customer with a valid Business Code. This report will also provide the Maximum, Minimum and Average number of cases created for a particular Reason For Contact for that particular type of Customer. This report will take From Date, To Date, Agent Group and Business Code as inputs and generates the report on the screen. All the input criteria will be mandatory.
    See the attachment for the Report.
    NOTE :1) FOR TOTAL,WE HAVE COUNT NUMBER OF CASES CREATED for a particular Reason For Contact for a particular Customer with a valid Business Code
      2) FOR Maximum, Minimum and Average CONSIDER number of cases created for a particular Reason For Contact for that particular type of Customer.
       For this report,I am using 5 tables. In the table ScaseParty  i have C_Bus_Code,C_cust_type coulumns are there.
      I am taking Input Criteria For Business code(ie c_bus_code).suppose business code is 'F0106',I have to get how many cases(means records) are there for a particular Reason For Contact for that Business Code.I AM GETTING THE TOTAL BUT
    for getting maximum,minimum,average , i have to check the C_cust_type For that Business code ,after that I have to take all the business codes for that C_Cust_Type and with in the business codes ,i have to take the maximum number of cases which business code have for that particular Reason for contact For that particular customer type.
    Eg: Reason for contact  Businesscode   customer type   
         Delivery Timing     0306            1        
         Delivery Timing     0306            1
         Delivery Timing     0310            1
         Delivery Timing     0310            1
         Delivery Timing     0310            1  
         Delivery Timing     0310            1  
       In this way i want the result
        Maximum =4 since, for reason for contact(delivery timing) for that customer type(customer type =1),the maximum no. of cases are 4 bcz, business code = 0310 comes 4 times.
    Minimum =2 bcz, business code = 0306 comes 2 times.
       The Problems i am facing
    1)  Since i have taken the input criteria Business code = 'f0106' ,the data filters in the where condition and the getting the number of cases exist for that business code(f0106) for that Contact of Reason data only.But i have to take all the business code exists for that Particular type of customer for that Particular reason for contact for getting the max,min,avg.
      I can't handle max,min,avg in one report since it checks total cases for that Business code only.
      SO,I THINK I HAVE TO INVOKE A SUBREPORT PASSING THE C_CUST_TYPE,iSN'T IT????
    2) iF I TAKE THESE THINGS IN SUB REPORT,HOW CAN I find out the maximum number of case with in the business codes for reason for contact for that particular customer type.
      CONSIDER THE ABOVE EXAMPLES, I AM GETTING 3 CASES FOR CODE = 0306 N 2 RECORDS FOR CODE= 0310 ,hOW CAN I GET mAXIMUM cASES ie 3  BY COMPARING THESE TWO CODES FOR THE DELIVERY TIMING  .  IS THERE ANY FUNCTION??????
    In which way i have to handle this report.
      Regards,
      Vijay
      mail : [email protected]

    Hi Vijay,
    The most efficient way to acheive what you want will be to create a stored procedure or command object in which you have a subquery that calculate your maximum, minimum and average values.
    If you are looking at a solution within Crystal Reports without having to write a SQL Query, then as you said, you can use a subreport that will returns the cases created for a particular Reason For Contact for that particular type of Customer.
    ( You will need to link the subreport to filter the data down )
    Then you can calculate the minimum values in the subreport by using the Minimum function and manually counting the values in a variable, the formula will look like:
    WhilePrintingRecords;
    Shared NumberVar MyMinimum;
    If Minimum({Business Code}) = {Business Code} Then
       MyMinimum := MyMinimum + 1;
    Insert the formula in the details section of the subreport.
    This will count the number of time the minimum Business Code appears in the subreport.
    You can create a similar formula for the maximum values by using the Maximum function.
    As for the average, you can create a summary that counts the number of of Business Code, divided by the distinct count of Business Code, so it will give you the average. The formula will look like:
    WhilePrintingRecords;
    Shared NumberVar MyAverage;
    MyAverage :=
    ( If DistinctCount({Business Code}) <> 0 Then
         Count({Business Code}) / DistinctCount({Business Code}))
    Then you can display the above shared variables on your main report.
    Hope this help!
    Regards,
    Patrick

  • 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

  • Passing a variable from subreport to the main report

    Hi guys, was unable to google this, so Im urning to you guys:
    I was wondering whether it was possible to do this:
    I have a subreport taking data from a table. In the main report, in the suppres condition of details section containing this subreport, I need to have a variable containing the total count of rows in that table. I know there are shared variables for that, but the problem is, that the variable in the condition is processed sooner than the one in the subreport.
    Any ideas on this?
    Thanks a lot

    To Sharma:
    Hi, unfortunately I can't. The subreport has its specific position in constallation with previous and following sections and must be right there.
    To Raghavendra:
    Hi, that was my first idea, but the problem is as I explained in my first message.
    To both:
    I have a table in subreport. This subreport is in main report positioned in details section "x". and I want to use that shared variable in the suppress condition of section "x". The problem is that the formula in suppress condition is processed sooner than the formula assigning a value to the shared numbervar inside the subreport.
    and thats what im looking for - a workaround for that. btw im using CR 8.5
    thanks again guys

Maybe you are looking for