Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Location
    Asia Pacific
    Posts
    14

    Unanswered: Computation between mainreport & subreport

    I have this report where it uses a sub report. My problem is i can't seem to compute an arithmetic operation say, var1 := var2 + var3, having the var3 in the sub report and var1,var2 in the main report. Is this doable or is there other workaround?

  2. #2
    Join Date
    Jul 2002
    Posts
    30
    you can use the "shared numbervar " variable declarations.

  3. #3
    Join Date
    Mar 2004
    Location
    Asia Pacific
    Posts
    14

    Red face

    Suppose i have this field in main report field1, field2 and another field in my subreport named field3. I have a fomula : sumfield := field1 + field2 + field3. How can i use the field3 located in the subreport for add together with al the fields in the main report? My problem is i don't know how to share a variable.
    And use it after can you please show me some coding with relates to my problem.

  4. #4
    Join Date
    Jun 2004
    Posts
    4
    when you first create the formula field you want to name it as follows:
    In your main report create your normal formula fields, which are 1 and 2.
    FORMULA FIELD1
    --enter this code--
    NumberVar field1;
    field1 = somevalue;

    FORMULA FIELD2
    --enter this code--
    NumberVar field2
    field2 = somevalue;

    Now you create a field to be shared with your subreport. Call it field3.

    FORMULA FIELD3
    --enter this code--
    Shared NumberVar field3;

    Now go into your sub report and create another field3 only this time you want to give it a value so that it gets sent to the main report.

    FORMULA FIELD3
    --enter this code--
    Shared NumberVar field3 := ValueToSend;

    the field3 value will now be used in both reports, keep in mind that you wont have a value in the main report until after the subreport has occured. Also it may be nesessary to add a clear formula for that value so that it does not keep adding onto itself every time the subreport occurs. to do this create another formula named clear or something.
    FORMULA CLEAR
    --enter this code--
    Shared NumberVar field3 := 0;

    Hope this helps, i know its tricky to understand without seeing it.

  5. #5
    Join Date
    Mar 2004
    Location
    Asia Pacific
    Posts
    14
    Hey mombrea, i've tried your suggestion regarding value linking between reports and done exactly as you suggested. I just changed "field1 = somevalue;" to "field1 := somevalue;" because it yields to either true or false not the actual value. Just the same, im just curious why is not my field3 does not display the value i wnated instead it displays the number 0.00. Can you help me further regarding this issue.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •