cancel
Showing results for 
Search instead for 
Did you mean: 

Passing variable from subreport to main report

Former Member
0 Kudos

Post Author: sjjustina

CA Forum: General

I've followed the instruction and I can't get the variable to pass back to the main report. This is my variable in the subreport. It's on the subreport suppressed because I don't what it to print there. It's on a section after the subreport section.

WhilePrintingRecords;Shared numberVar TotalMAC;TotalMAC = {far_item.pricequantity}

formula name is TotalMACSub

This is the main reportWhilePrintingRecords;Shared numberVar TotalMAC;TotalMAC;

formula name is TotalMACMain

Thanks in advance, Sarah

Accepted Solutions (0)

Answers (13)

Answers (13)

Former Member
0 Kudos

Post Author: sjjustina

CA Forum: General

Someone gave me the answer, I needed to initialize the variable in the main report and it's working now. I wanted to share the answer.

Thanks for all your help. Sarah

Former Member
0 Kudos

Post Author: Amir

CA Forum: General

Well, this is really strange. JUst make sure that the section (report footer on the main report containing the formula) is not conditionally visible. Also make sure your shared variable is not being assigned any value in your main. Good luck.

Former Member
0 Kudos

Post Author: sjjustina

CA Forum: General

No, it is not an on-demand report. The subreport is on a report footer and the sub formula is a sum field on the sub's footer. Where I want it on the main report is a report footer also below the subreport.

Former Member
0 Kudos

Post Author: Amir

CA Forum: General

Is your subreport an On-Demand report? if so it will not work. Subreport will not pass the value. If not, in what section of the main report are the subreport and formula?

Former Member
0 Kudos

Post Author: sjjustina

CA Forum: General

Yes, it returns a lot of data from various tables

Former Member
0 Kudos

Post Author: Amir

CA Forum: General

Is your main report returning any records?

Former Member
0 Kudos

Post Author: sjjustina

CA Forum: General

I'm sorry if I wasn't clear, when I don't supress it, it prints on the subreport but not on the main report. I can't suppress the subreport as it has a lot of data that needs to print.

Former Member
0 Kudos

Post Author: Amir

CA Forum: General

So, if you can pass the value when subreport is not suppressed then:

- Make sure the subreport box cannot grow (check box clear)

- suppress all section in the subreport except report footer

-place your formula in the report footer (in subreport), then reduce the sureport box hight, remove border lines, etc. in other words hide it in the main report.

Former Member
0 Kudos

Post Author: sjjustina

CA Forum: General

1- Yes, it should have been := and I change it

2- I made it visible on the subreport and it prints

It's still not working but thanks for the help. Any other ideas?

Former Member
0 Kudos

Post Author: Charliy

CA Forum: General

Good catch! Yes your problem is you should use := to assign values to a variable.

Former Member
0 Kudos

Post Author: Amir

CA Forum: General

1- Shouldn't you be using := rather than = in assigning value to your shared variable?

2- Also double click on subreport and see if you can see the value, if so don't suppress the subreport see if it makes a difference.

Former Member
0 Kudos

Post Author: sjjustina

CA Forum: General

I tried that too and it doesn't work???

Former Member
0 Kudos

Post Author: Charliy

CA Forum: General

The only line in the formula in your main report should be: Shared NumberVar TotalMAC