Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get values from subreport 1 and use them in sebreport 2

Status
Not open for further replies.

maas

Programmer
Sep 3, 2009
148
BH
Hello Everybody,

I am having 2 subreports and each one of them is in a separate Group Header. One is in Group Header #1 a and the second one is in Group Header #1 b.

The first subreport is having the:
deal No. and the calculated amount(passing a date parameter and then sum total amount - deal.amount for each deal)

Now, my question is in the second subreport:
I am having there only the deal no and I want to get the values of the calculated amount for each deal from the first subreport and pleace it near the deal no, so I can continue doing the calculations

Is this possible, if So How??

Thanks
 
You have to set up the calculation i nthe first subreport as a shared variable. Then in the second subreport, you can reference the shared variable in a formula to do further calculations. I'm assuming the subs are linked to the main report on deal no and that that is your group field in the main report.

-LB
 
Thanks lbass for your reply.

So, in my case the first subreport will have
Deal No, Calculated Amount , and the shared variable for the calculated amount and I should place it in the details section. Is this correct?

As you said the link will be deal_no and also I am having rptNo. so these two links

and in the second subreport, I should link again the deal_no and rptno and the fields will be deal_no and the shared variable?

So, Only in my case I have to define the shared variable in the first subreport as:
shared numbervar calculated_amount;
calculated_amount:={@calculated_amount}

and in the second subreport, I should called it again : shared numbervar calculated amount;
or I should put other lines of codes?

Thanks
 
The shared variable in the first subreport should be in the subreport footer--assuming there is one value being shared each time the main report group executes. I don't know what is in the formula you are sharing, but I assumed it might be a summary.

When you reference the shared variable in the second subreport, you can then do calculations in the formula if you want, or you can just display it:

whileprintingrecords;
shared numbervar calculated_amount; //stop here if only to display
calculated_amount*{sub2table.amount} //if you want to calculate

-LB
 
lbass for example, in subreport 1 the values are:
deal_no, calculated amount
1,123
2,4455
55,778

In subreport2, I want it again to display the same values, but the calculated amount should be a shared variable which it is coming from subreport1 not being calculated again, can this be done?
1,123
2,4455
55,778
 
As I said, all you need is the following in sub2.

whileprintingrecords;
shared numbervar calculated_amount;

Why do you ask? What results are you getting that are unexpected? Note that you cannot suppress sub1 or the section it is in. You can however make the section and the sub disappear if you want to. Please clarify.

-LB
 
Hello lbass,

The problem is that a result which is showing in the report footer, the user wants it at the beginning in the group Header #1. The problem is that two fields in the details sections, are caluclated based on 2 different subreports and There is a prompt where the user should enter the date.
In one of my previous topics, I mentioned that I want to calculate the percentage and the answer was to create a subreport which has the content of the main report and place it at the beginning. So, I am trying to do that

Thanks
 
I don't see how your last post relates to the earlier ones, where you were trying to pass calculations between two subreports in a group header section.

Note that you cannot create a subreport that contains other subreports, and you cannot share a variable up to an earlier section.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top