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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Share Values from subreport 1 to subreport 2

Status
Not open for further replies.

maas

Programmer
Sep 3, 2009
148
BH
Hello All,

I am having two subreports in my main report. They are placed in group header 1#: where it is called "Account Name". In Group Header 1A: I have created a subreport ((1))called market_Value which has to columns in the details.
Details: Deal_no & Market_Value
In the next subreport ((2)), I need to get the Market_Value from subreport 1 and match it to the deals in subreport 2 where I need to add more calculations. So, how can I pass the amount for each deal from subreport 1 to subreport 2 as shared variables.
I tried to Create a shared numbervar, but it gave me zero. How can I do that and what are the required links?

Thanks
 
The subreports need to be in different group header sections, so put sub1 in GH1a and sub2 in GH1b. Link the subs to the main report on deal number (You might want to insert a main report group on deal and then place the subs in deal group headers #2a and #2b. Place the shared variable formulas in the report footers of the subs. Do not suppress the sections containing the subs. If you need the subs not to display, there is a different method.

-LB
 
Hello lbass,

Currently sub 1 is in GH1 A and Sub2 in GH1 B. But, the problem is that the deal_no group is lower. It is group no. 6 in the report and I am dealing with GH 1. Before posting this thread, I tried to make it higher but, I can't. So, is there is another way to get the market value from sub1 to sub 2?
 
If you need to match deal numbers, then the subs should be in the lower deal_no group. If you then need to sum the shared values at some higher group level, you can.

-LB
 
Please correct me if I am wrong:

So, now I have to keep the two sub reports in deal_no group and change the link of both and match the deal_nos in the main report to the deal_no in each report and create the shared variables.

Secondly, if I am getting the grand total of the market values in the second sub report. Can I take this grand total and use it in Group Header 1 in the main report?
 
No, you can't share a variable result in a section above where the subs reside. I only suggested the placement in the dealno group because you said they needed to match. I think you should show a sample of what you are trying to achieve. If you just need a total from all the deal numbers (the same set), then the approach would be different.

-LB
 
lbass,
what I am trying to do is, here is my report
GH 1 A: Account Name Sum(grand market value total* 100)
GH 1 B: sub report 1
GH 1 C: sub report 2
GH 6 A: deal_no
Gh 6 B: Subreport 3 where I am getting the deal_nos and pass date to get their amount in that date
GH 6 C: subreport 4 where I am getting the deal_nos and their market value from a command and then share the value in the {@marketPrice} formula
Details:
Deal_No, {@Amount}: I am having if statement,{@MarketPrice} sharedvalue* capital/ 100, {@Market_Value} Market Price * Amount / 100
GF 1 : {Grand_Market_Value} Sum ({@Market_Value}), This is the total which I want it to be in GH 1 A

In sub report 1:
I am showing deal_no & Market_Value where I am having a function to calculate the Market_Value

In the second sub report:
As you have helped me previously to do that is to create another subreport which has the details of the main report and put it in the report header, but I can't since there are lots of subreports which i am getting the values for them.
So, what I think to do is to pass the market value from sub report 1 and share it in subreport 2 and by that I will calculate the sum of (grand market value) and pass it as a shared variable to the main report.

Also, I tried to add a command and link the current deals table to the command which it has( the command has only two fields, deal_no and market value) in sub report 2, and link deal_no in table deals with the new deal_no in the command, but it showed an error. I did an inner join link between them from deals to the command.

So, do you have any suggestions ?
 
I meant for you to show some sample data, along with the structure. When you refer to formulas you should show their content. As it is, I can't really follow what you are trying to do.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top