Crystal Reports 10, Want to pass values from subreports to main report

Post Author: playmkr278
CA Forum: General
Is there a way to just share values out of subreports.
The reason I ask is that I am having problems pulling the correct information in one subreport so I'd like to use 2 subreports to pull out Billable hours on one and Billed Hours on another and then add them together to display on the main report.

Post Author: Jedit
CA Forum: General
Yep there is!
In your sub report
I the formula editor create a shared variable then create the same variable in your main report.
EG
IN your SUB
Create new formular called tothrs etcu2026..
whileprinting records;
shared numbervar tothrs: sum({table.fieldname}]
In Your Main Report
whileprinting records;
shared numbervar tothrs
this passes the value from your sub to the main, check help for different types of format as the one above is only for a number there are others for time & date etc..
hope this helps!
I have been doing a similar exercise myself but got stuck summing the parameter values in my main report, if you solve this let me know?
Please see http://technicalsupport.businessobjects.com/cs/forums/thread/6210.aspx

Similar Messages

  • Passing values from subreport to main report

    Dear All,
           I have used shared values in my sub report and i want to use that shared variable in my main report in one of the formulas for average calculation but i see the values as 0.
    Can someone let me know what I am missing.
    Regards,
    Sonali

    Hi
    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 since the report will not be processed until after clicking report.
    Regards
    Sourashree

  • How to get shared date value from subreport to main report

    Hi,
    I need your help in passing the value of a running total that is located in the subreport to the main report. The running total in the subreport is getting the maximum of the Effective Date (which it is type in the database is date) for each group and it is value will change on the change of the sequence no. group. I am printing the value at the group footer which displayed correctly. Now my issue is that how to pass the value from the subreport to the main report as a date. I have created a formula that it is having the code:
    shared datevar ddd := date(0,0,0);
    ddd:={RTotl0}
    The above formula is not compiled and it is first giving me an error at line 1 that date(0,0,0) is not accepted. Then when I removed it, it gave me an error that ddd:= can't have a running total to a datevar.
    So can you please help in getting the value from the subreport and then to pass it to the main report as a formula as I need to include it in other formulas which it compares the dates.
    Thanks

    Hi Mohammed,
    Are you displaying the shared variable on the Main Report's group footer as well?
    Try changing the code to:
    shared datevar ddd := cdate(0,0,0);
    ddd:= date({RTotl0});
    -Abhilash

  • Passing Array From Subreport to Main Report then Summing

    Hi,
    I am having troble passing an array from a sub report to the main repport.  I have managed to create the array, pass it and display it in the main report, however the first value of the array is displayed twice.  Here is the  formulae I have used:
    In the sub report:
    whileprintingrecords;
    shared stringvar str;
    str:=str{@value}","
    In the main report:
    whileprintingrecords;
    shared stringvar str;
    stringvar array arr;
    arr:=split(str,",");
    join(arr,",")
    Also, when I have managed to resolve the problem of the first value printing twice, I hope to change the array back to a number array and sum all of the values together.  I'm not too sure how to do this either.
    I hope you can help.
    Julie

    Ummm... Isn't Join(Split(str,","), ",") = str?  Why bother with the two extra lines of code?  Also, are you sure the subreport isn't creating the "duplicate first value"?  (I.e.  The data has the same value on two records, so it's being added twice?)
    Also if you're looking for the sum, why not create another shared variable and sum the value in the subreport as you're building the array (assuming you need the array for other purposes)?
    HTH,
    Carl

  • Passing the values from subreport to master report in JasperReports

    Hi All,
    I want to pass the values from subreport to master report, but my subreport is without any query.
    Please help me in this regard. its urgent.
    Thanks & Regards
    Kris

    Hi,
    Below link may help you
    http://jasperreports.sourceforge.net/tips.tricks.html#returnvalues
    regards
    MJ

  • Passing a variable from subreport to main report

    Hello,
    Was hoping to get some assistance on this issue I'm facing.  I've got a sub-report that calculates a monthly goal based off the date selection criteria. And I'd like to pass this goal back to the main report.
    In my sub-report, I created a new formula named ProcGoalVariable:
    WhilePrintingRecords;
    Shared Numbervar ProcedureGoal := cdbl({#ProcGoal})
    While {#ProcGoal} is a running total I created for the sub-report and now I'd like to pass it back to the main report.
    In the main report, I created a new formula named ProcGoalVariable:
    Shared NumberVar ProcedureGoal;
    ProcedureGoal;
    But when I drop this into my report, it is returning a value of 0.  In the screen shot, the Proc. Needed should actually equal the Proc Goal:
    Any suggestions on how to pass this correctly?

    Thanks for the advice,
    I want to rewind a bit to make sure I am explaining myself clearly.  My sub-report is pulling the correct numbers and it is located in GF#3 and contains two values that fall under "Proc Goal" and "Prod Goal". These are being calculated correctly and I would then like to pass them back to the main report for additional calculations done on this.
    In the sub-report, a formula was created "ProcGoalVariable":
    WhilePrintingRecords;
    Shared Numbervar ProcedureGoal := cdbl({#ProcGoal})
    In the main report, a formula was created "ProcGoalVariable"
    Shared NumberVar ProcedureGoal;
    ProcedureGoal:=ProcedureGoal;
    Would having the same name inside the formulas being causing the issue? And I've tried inserting a new section below the section where my subreport lives and I still get a value of 0.
    Not sure what else to try at this point.

  • Passing Shared Variable from subreport to main report

    Hello,
    I am having difficulty passing the shared variable from the subreport to the main report.  For some reason, when viewing the data, the value for the very first row is returning a 0 but the second row is returning the value that should be in the first row.   Does anyone have an idea of what I'm taking about?
    Thanks.
    Z

    In Subreport there is a group based on the client.  There is a summarized amount field in this grouping.  I placed a formula in the grouping and suppressed it.  The suppressed formula is listed below.
    {@ store client payments}
    WhilePrintingRecords;
    Shared CurrencyVar cRelatedPayments;
    cRelatedPayments := cRelatedPayments+Sum ({amount.amt}.{client.client_number});
    cRelatedPayments;
    In the main report, there is 2 groupings, first grouping is the client and second is the invoice.  The client grouping is displayed while the invoice grouping is suppressed.
    The following is the formula in the main report to get the shared value.
    WhilePrintingRecords;
    Shared CurrencyVar cRelatedPayments;
    cRelatedPayments;
    This is placed in the client grouping.
    I hope this helps.
    Z

  • Pass Value from Excel to custom program

    Hello,
    I want to pass value from Excel to Custom Program being called in the Custom Integrator and i am using the Import in the Importer section but it is not getting passed.
    Please advise and i am on R12.1.3.
    Thanks

    Pl do not post duplicates - Concurrent Program Parameter

  • Passing value from Webdynpro ABAP to Adobe form..

    Hi experts,
            In first view of web dynpro, im getting employee id as input and after clicking the create new button, an adobe form is called
    to create the employee details ( in form i used the submit button and i stored the details ). so, in tat form i used the employee id as read only mode and it has to display the value which i given as input. But in tat form im not getting the value from web dynpro..
    can anyone plz help me out for this..
    Thanks in advance..

    Hi,
    Try to set your values in Method->"wddomodify" of the View in which Adobe Form is present. If you want to pass values from one view to another then check this link [Passing Local Parameters between views in an ABAP Web Dynpro Application|http://wiki.sdn.sap.com/wiki/display/stage/PassingLocalParametersbetweenviewsinanABAPWebDynproApplication] or use Context declared in Component Controller.
    Regards
    Pradeep Goli

  • Passing value from JSP to JApplet

    Hello,
    I am stuck up with a problem, can anyone please tell me how do i pass a value from a JSP page
    to a JApplet,
    and the parameter passed through JSP should be displaed in the JTextArea.
    It would be kindful if any of you could help.
    Thanks
    Sanam

    hello,
    thanks for reply.
    I know how to pass parameters from html,
    I want to pass values from jsp page,
    and i dono how to do it, may be we cann pass values through url connection but i dono how.
    if anone knows plz help me in solving this.
    i hvae posted my applet code.
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.JToolBar;
    import javax.swing.JButton;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    import javax.swing.JScrollPane;
    import javax.swing.JPanel;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.sql.*;
    <applet code = "DocApplet" width = 500 height =5000>
    </applet>
    public class DocApplet extends JApplet
         private JPanel jp;
         private Container cp;
         private JTextArea jt;
         private JToolBar tb;     
         private JScrollPane sp;
         private String annotation;
         private String url;
         private Connection con;
         private Statement stmt;
         public void init()
              jp = new JPanel();
              cp = getContentPane();
              jt = new JTextArea();
              tb = new JToolBar();
              sp = new JScrollPane(jt);
              repaint();
         public void start()
              jp.setLayout(new BorderLayout());
              jp.add(tb, BorderLayout.NORTH);
              jp.add(sp, BorderLayout.CENTER);
              jt.setBackground(Color.BLACK);
              jt.setForeground(Color.WHITE);
              setContentPane(jp);
              addButtons(tb);
              repaint();
         public void run()
              repaint();
         public void paint()
         private void addButtons(JToolBar tb)
              JButton button = null;
              button = new JButton("Save");
              button.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent e)
              tb.add(button);
    }

  • How to Pass values from XML to JSP??? Urgent Please Help me

    Hi guys,
    I am new to XML, I want to pass values from XML to JSP. I have a xml file with attributes, I should send this values to a JSP file. How is it??? Please Help guys.... its very urgent. Please send me how to do it with an example or atleast any urls related that....
    Looking for ur favourable reply.
    Thanks in advance,
    Sridhar

    in a servlet :
    parse your xml file (see how at the end of the post) and
    put the values you want in the request attributes
    request.setAttribute("value1", value1);
    ...redirect to the jsp
    in the JSP:
    get the wanted attributes:
    String value1=(String)request.getAttribute("value1");To learn how to parse a xml file, pay a look at this page, it explains how to read the XML document to build an object representation, and then how to navigate through this object to get the data
    http://labe.felk.cvut.cz/~xfaigl/mep/xml/java-xml.htm

  • Passing value from JavaScript window to form

    Hi,
    Coul'd You help me?
    I have a test form. I open new JavaScript window from this form. I generate list of authors in this window by the procedure show_list. I want to pass value from JavaScript window back to test form, but
    the command "window.opener.document.forms[idx_form].elements[idx_fld].value = val;"
    don't pass value to test form. Where is mistake?
    Thanks Vaclav
    -------------- test form --------------
    <HTML>
    <HEAD>
    <META http-equiv="Content-Type" content="text/html; charset=windows-1250">
    <TITLE>Edit</TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Comment out script for old browsers
    function get_list(frm, fld)
    var idx_form, idx_fld;
    idx_form = get_idx_form(frm);
    idx_fld = get_idx_field(idx_form, fld);
    var w = open ("http://vasekora/pls/portal309/ahs.RD_CISEL.SHOW_LIST" + "?startPg=1" + "&master_fld=" + "ID_AUTHOR" + "&slave_fld=" + "NAME" + "&ownr=" + "REDAKCE" + "&tbl_name=" + "AUTHORS" + "&cmd_qry=" +"" + "&idx_form=" + idx_form + "&idx_fld=" + idx_fld,"wn_Authors","width=500,height=600,resizable=yes,menubar=yes, location=yes");
    if (w.opener == null)
    w.opener = self;
    w.focus();
    function get_idx_form(p_form_name)
    var v_index, v_full_name, v_return;
    for(v_index=0; v_index < document.forms.length; v_index++)
    v_return = -1;
         v_full_name = document.forms[v_index].name.split(".");
    if (v_full_name == p_form_name)
         v_return = v_index;
              break;
    return v_return;
    function get_idx_field(idx_form, field_name)
    var v_index, v_full_name, v_return;
    for(v_index=0; v_index < document.forms[idx_form].length; v_index++)
    v_return = -1;
         v_full_name = document.forms[idx_form].elements[v_index].name.split(".");
    if (v_full_name == field_name)
         v_return = v_index;
              break;
    return v_return;
    //-->
    </SCRIPT>
    </HEAD>
    <BODY>
    <FORM NAME="f_aut_new" ACTION="javascript:testclose()" METHOD=POST TARGET="_blank">
    <INPUT TYPE="text" NAME="id_aut">
    <IMG SRC="images/list.gif" alt="Seznam" border="0" align=bottom><BR><BR>
    <INPUT TYPE="submit" VALUE="Save">
    <INPUT TYPE="reset" VALUE="Cancel">
    </FORM>
    </BODY>
    </HTML>
    -------------------- end test form --------------
    procedure show_list
    startPg integer,
    master_fld varchar2,
    show_fld varchar2,
    ownr varchar2,
    tbl_name varchar2,
    cmd_qry varchar2,
    idx_form integer,
    idx_fld integer
    is
    TYPE cur_typ IS REF CURSOR;
    c cur_typ;
    c_cnt cur_typ;
    i integer;
         pg rd_types.pages_t;
    odkaz varchar2(4000);
    bk_url varchar2(4000);
         s1 varchar2(4000);
         var_mfld integer;
         var_sfld varchar2(8000);
         bl boolean;
         var_cmd varchar2(2000);
    begin
    htp.HTMLOPEN;
    htp.HEADOPEN;
    htp.p('<SCRIPT LANGUAGE="JavaScript">');
    htp.p('<!-- Comment out script for old browsers');
    htp.p('function Close_List(val, idx_form, idx_fld)');
    htp.p('{');
    htp.p('window.opener.document.forms[idx_form].elements[idx_fld].value = val;');
    htp.p('self.close();');
    htp.p('}');
    htp.p('//-->');
    htp.p('</SCRIPT>');
    htp.HEADCLOSE;
    htp.BODYOPEN;
    if cmd_qry is null then
    s1 := 'SELECT a.'||master_fld||', a.'||show_fld||' FROM '||ownr||'.'||tbl_Name||
    ' a ORDER BY a.'||show_fld;
    else
    var_cmd := UPPER(cmd_qry);
    s1 := 'SELECT a.'||master_fld||', a.'||show_fld||' FROM '||ownr||'.'||tbl_Name||
    ' a WHERE UPPER(a.'||show_fld||') LIKE ''%'||var_cmd||'%'' ORDER BY a.'||show_fld;
    end if;
    i := 1;
    OPEN c FOR s1;
    LOOP
    FETCH c INTO var_mfld, var_sfld;
    IF c%FOUND THEN
    IF i >= pg.StartRec AND i <= pg.EndRec THEN
    odkaz :=''||var_sfld||'';
    htp.p(i||': '||odkaz||' ('||var_mfld||')<BR>');
    ELSE
         IF i > pg.EndRec THEN
         EXIT;
         END IF;          
    END IF;
    ELSE
    EXIT;
    END IF;
    i := i + 1;
    END LOOP;
    htp.p('<BR><B><INPUT TYPE=BUTTON ONCLICK="javascript:self.close();" VALUE="Close"></B><BR><BR>');
    CLOSE c;
    htp.BODYCLOSE;
    htp.HTMLCLOSE;
    end;

    If this makes any difference: Instead of using "var w = open..." try "var w = window.open..."

  • Java Thread - difficulty while passing value from parent to child thread

    Hi All,
    I am calling a java program from a unix script .
    My oblectives are
    1)to pass value from scripts to main java class
    2)main class should create a child thread and pass data to child and should return control back to script
    3)child thread should run independtly of parent
    The calling unix script is part of process and hence should return control back to its calling script immediately.
    Findings
    1)Without passing data thru setter getter /constructor method to child thread my objectives are met
    2)When I pass the data from parent thread to child thread calling unix scripts wait till child thread finishesh its working
    call.scr
    java Main <list of Arguments>
    Main.java
    public class Main
                 public static void main(String args[]) throws Exception
                 String data2="Z";
                 String data1=null;
                 for(int i=0;i<args.length;i++)
                      data2=data2+","+args;
    data1=data2;
    Child cu=new Child();
    cu.setData(data1);
    data2=null;
    data1=null;
    cu.start();
    Child.javaclass Child extends Thread
    public String data;
    void setData(String data)
    this.data=data;
    public void run()
    ----------> processing on data
    I think due to passing of data from parent thread to child thread (Inter thread data communication/Inter process communication)
      the threads are not working as desired.
    Plz anybody can suggest something.....
    Thanx.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    aschin,
    You seem to be confusing Java Threads with Operating System Processes.
    If you want you're java program to run in the unix background then you'll need to run it in the unix background. Java (being o/s agnostistic) doesn't provide process manipulation functionality (which would include the ability to throw itself into the background, as a C program can) in the standard API, and it's hard to imagine any third party producing anything as low level as a process controler... so yeah, just start the java program in the background... and you'll need to workout some interprocess communication protocol... named pipes have worked well for me in the past, as they doesn't suffer from the quit same performance issues as real disk files.
    Good luck. Keith.

  • Passing values in Subreport

    Hi,
    In GH1: i have one subreport
    In GH2: i have two or three subreport
    My question is, i have to pass the GH2 sureport values to GH1 Report Header. can any one explain?

    by using shared formulas.
    These are my personal crib notes and formula names to remind me how to do it:
    Shared variable formulas for subreport/main report,
    must use same <var name> in each shared formula variable declaraions. 
    also use the same <var name> in naming shared formulas & in related running
    total formula names and declared variables to mentally link them together.
    Shared formulas work in either direction.  Order of appearence on report controls
    primary/secondary. To go from subreport to main report, @mainform.<shared var> 
    must appear after the subreport in the main report.
    subreport shared formula - primary; must "print" in subreport-can be white text
    and/or off the 'page' but do not suppress
    1. {@subform.field1} <<<sample formula
    ////{@subform.<var name>}   stores the figure to be shared with main report.
    whileprintingrecords;
    Shared numberVar <var name> := <source field or formula name>;
    main report shared formula - secondary. must "print" in main report after subreport;
    can be white text and/or off the 'page', but do not suppress; use same <var name>
    as subreport formula
    2. {@mainform.field1} <<<sample formula
    //{@mainform.var name>} retrieves {@subform.<var name>}
    whileprintingrecords;
    shared numberVar <var name> ;
    <var name>
    You could then share the formula to the next subreport by putting the shared formula
    {@subform.field1} in the next subreport.

  • Passing Value from Crystal Report (special function) to Business View parameter

    Friends,
                 Í have a scenario where i need to pass value from Crystal Report to a Business view's parameter.
    Eg : CurrentCEUsername (func in crystal report)-- gives login user  which i should pass to parameter in a Business view (used in the same report).
    Will be able to explain more if required.
    Thanks in Advance,
    Bharath

    I guess you got the picture wrong.  User_id is not a report_level parameter .
    In Data Foundation, below query is used..
    select Acc_Number, Account_Group,User_id  from Accounts where user_id={?User_id}
    where in {?User_id}  is the BV parameter...
    The Filter was a solution. But it takes long time to Query all the data from DB and then filter at BV level.
    How do i pass the CurrentCEUsername to {?User_id}
    Value should ve CurrentCEusername always. so that query will be
    select Acc_Number, Account_Group,User_id  from Accounts where user_id=CurrentCEusername
    It will restrict the data pulled from DB to BV .. right?

Maybe you are looking for

  • Can't find any project/backup after updating to Mavericks

    Hello, I've updated to Mavericks and my project disappeared from FCP, I've found the folder in Documents\movies, with the name of my project but it appears there's no project library in there, there's a folder called backup with .fcproject file, but

  • F.13 (SAPF124) not clearning balances

    Hi Folks, I am facing a situation where for few transactions GR /IR is not getting cleared while running F.13; I have checked both the documents and seems fine. Also I have checked the setting in OB74; all the relevant criteria have been specified. (

  • Qaaws input parameter mapping

    It is very time consuming to map a lot of input parameters to Qaaws data providers in Xcelsius.  This thread is to find out if anybody knows of any flexcelsius code that can help automate that or if SAP/BobJ is planning any enhancements to make this

  • Control firefox with a java application?

    Hy! As the subject says, I'm trying to make a Java app that would control firefox through a simple GUI interface. For example, lets say there are two buttons on my GUI ("back" and "forward") then when i click on them the resolt should be the same as

  • Starting Weblogic 6.1 failure extracting WAR classes

    Hi there, I'm getting several error-messages when starting my weblogic 6.1 saying: <Jan 10, 2002 9:07:32 AM CET> <Error> <HTTP> <[WebAppServletContext(4057696,cert ificate,/certificate)] failure extracting WAR classes java.io.IOException: Permission