cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

main report / subreport parameter

Former Member
0 Likes
325

hi -- I have a report S and a report M. S is run stand-alone, and it's also included in M as

a subreport.

In S, there's a text object that needs to be displayed when S is running standalone. It needs

to be suppressed when S is being run as part of M.

I think I need a parameter in S that's set to false by default, but when it's part of M, a subreport

link from M to S will set it to true. I don't want either of these "parameters" to be editable (or even seen)

by the user... that's one of the things I'm having trouble with.

How can I accomplish this... either w/ parameters or something else?

Thanks,

Carol

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

In M's Report Header section, add the following formula object:

@SetSubreportFlag

shared booleanVar MasterReport := TRUE;

You can suppress the Report Header or the formula object to hide the resulting TRUE value.

In the subreport, edit the text object's properties and enter the following suppression formula:

shared booleanVar MasterReport;

MasterReport

When a boolean variable is declared, it defaults to FALSE, so when you run your subreport as a stand-alone report, the shared variable MasterReport will default to FALSE and your text object will not be suppressed. But when the subreport is called from the main report, the shared variable MasterReport will have previously been set to TRUE and therefore the text object will be suppressed.

Fuskie

Who hopes this helps...

Former Member
0 Likes

Fuskie -- Worked like a charm... thank you!

Carol

Answers (2)

Answers (2)

Former Member
0 Likes

hi Carol,

I have tried this and it got worked with shared variable concept.

In Main report 'M', create a formula

Formula Name: F1

Definition :

shared numbervar i:=1;

i;

And now drag the formula on top of main report.

In Sub report 'S', create a formula

Formula Name: F2

Definition :

shared numbervar i;

i;

And now drag the formula on top of Sub report.

Now go to text box in Sub report and right click -> Format Text -> Suppress

Write the below condition :

if {@F2} <> 0 then true

Save the report and refresh it once.

Text box is visible in Subreport for standalone mode.

When Main report 'M' is refreshed, text box will not appear.

Hope this works for you too.

Regards,

Vamsee

Former Member
0 Likes

Hello Vamsee -- I've tried this, but it's not working. The text box is displaying when S is run standalone or

in the main report. I've checked and double checked and am sure I've duplicated what you suggested.

I put a text box in both M and S to display the value of the formula field (eg the shared variable)

to at least try to see if my formatting formula is correct.

The value in M is 1 (which I'd expect).

When S is run standalone, the value is 0. But it's also 0 when it's run within M. I've refreshed both reports (actually what I've done

is, after setting all this up, I completely removed S from M, saved and closed M, re-opened it and re-included S... so I'm

quite sure it has the most current version of S).

It seems to me that my shared variable either isn't getting passed into S from M at all (it should override the value of

the shared variable in S... is that correct?). Or possibly it gets passed after the suppress formula is evaluated. Is

that possible? I've read some things on the forum regarding evaluation time for shared variables, but I'm not sure

how they apply to me.

Thanks,

Carol

Former Member
0 Likes

Hello Vamsee -- I've tried this, but it's not working. The text box is displaying when S is run standalone or

in the main report. I've checked and double checked and am sure I've duplicated what you suggested.

I put a text box in both M and S to display the value of the formula field (eg the shared variable)

to at least try to see if my formatting formula is correct.

The value in M is 1 (which I'd expect).

When S is run standalone, the value is 0. But it's also 0 when it's run within M. I've refreshed both reports (actually what I've done

is, after setting all this up, I completely removed S from M, saved and closed M, re-opened it and re-included S... so I'm

quite sure it has the most current version of S).

It seems to me that my shared variable either isn't getting passed into S from M at all (it should override the value of

the shared variable in S... is that correct?). Or possibly it gets passed after the suppress formula is evaluated. Is

that possible? I've read some things on the forum regarding evaluation time for shared variables, but I'm not sure

how they apply to me.

Thanks,

Carol

Former Member
0 Likes

I just wanted to add a couple of things:

I've thought about trying to check the file or report name... but I'm not sure that will work... that is, that the name of main report is accessible within the subreport. I'm not having any luck w/ this option.

Also, I'm looking at shared parameters. I have one, we'll call it X, that's TRUE in the main M and FALSE in the standalone / subreport S. I've not used them before... I'm not sure if it has to be explicitly passed in to the subreport, or if X can be set in S but then will be overwritten if there's a value in M...

Regardless, my suppress formatting formula evaluates to true if the value of X is true. However, I get the message that the formula can't be evaluated until later, so I'm not sure how to get around that....

I'm floundering a bit. Suggestions appreciated!

thanks,

C