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!

Exclude records from subreport 1

Status
Not open for further replies.

maas

Programmer
Sep 3, 2009
148
BH
Hello All,

I am having Group Header 1: Account No. in my main report and in the details, I am having deal_No & amount.

In the select expert I have defined a set of accounts like (123, 456, 223, 124). IF there is data, the report will show the figures correct otherwise if there aren't any figures, the account No.s will not be shown.

In the subreport, I am listing again in the select expert, the account no.s(123, 456, 223, 124).

Now, if i want to pass the accounts that are having data to the subreport and exclude them in the subreport from the select expert, so the account no.s which did not show in the main report, I will list them in the subreport.

I am a little bit confused, can you please help on how to do this?
 
Is that the only purpose of the subreport? Because you don't really need a subreport to list the non-displayed accounts.

-LB
 
If you just want to list the missing accounts, create two formulas:

//{@acctsinreport} to be placed in the detail section and suppressed:
whilereadingrecords;
stringvar acct;
if instr(acct,{table.acct}) = 0 then
acct := acct + {table.acct}+", ";

//{@display} for the report header:
whileprintingrecords;
stringvar acct;
stringvar missing;
numbervar i;
for i := 1 to ubound({?acct}) do(
if not({?acct} in acct) then
missing := missing + {?acct} + ", "
);
if len(missing) > 0 then
"No data for: " + missing

-LB
 
Hello lbass,

what I am looking for is that in the main report the accounts with their details will shown. And in the subreport, the account balances will be shown as a group total without the details section because they don't contain any data.
 
I have created the formula {@acctsinreport} in the main report.

What should I pass to the subreport? Should I pass the group name or the account no.?

I tried to put the {@display} in the subreport, but it is showing an error that an array need to be defined when it reached the parameter field{?acct}
 
lbass,

my final report structure and what I did is:

main report:

Group Header 1:# Account Name{@acc-groups} (Ex. MM100, MM200, MM300, MM400)
Group Header 2:# Account No.(123, 456, 223, 124)
Deatils: Deal_No, Amount
Group Footer 2
Group Footer 1

If the account name is shown in the main report, I want it to be suppressed in the subreport. ex( if MM100 is the main report, it should not be shown in the subreport)

The subreport structure is:

Group Header 1:# Account Name{@acc-groups} (Ex. MM100, MM200, MM300, MM400)
Group Header 2:# Account No.(123, 456, 223, 124)
Group Footer 2
Group Footer 1 Sum(Amount, {@acc-groups})

What should I pass to the sub report and what should I do in the section expert?

Thanks
 
My suggestion would only have worked if you were just trying to list the missing accounts. I think you implemented it incorrectly, as the formulas above worked for me.

Please explain where the subreport is located (in what main report section).

-LB
 
The subreport is located in the report footer in the main report.

main report:

Group Header 1:# Account Name{@acc-groups} (Ex. MM100, MM200, MM300, MM400)
Group Header 2:# Account No.(123, 456, 223, 124)
Deatils: Deal_No, Amount
Group Footer 2
Group Footer 1

Suppose if MM100 is shown in the main report, it should not be shown in the subreport)

The subreport is located in the report footer and it's structure is:

Group Header 1:# Account Name{@acc-groups} (Ex. MM100, MM200, MM300, MM400)
Group Header 2:# Account No.(123, 456, 223, 124)
Group Footer 2
Group Footer 1 Sum(Amount, {@acc-groups})

How do I pass those accounts which are shown in the main to the subreport and suppress them while viewing.

In the select expert of both main report and subreport, I am selecting the accounts (123, 456, 223, 124)
Account No. in [123, 456,223,124]
 
In the main report, create a formula {@sharedaccts}:

//{@acctsinreport} to be placed in the detail section and suppressed:
whileprintingrecords;
shared stringvar acct;
if instr(acct,{table.acct}) = 0 then
acct := acct + {table.acct}+", ";

This is the same formula as earlier except that the variable is defined as "shared" and it should be set up with "whileprintingrecords". Then in the subreport, in the section expert, select the displayed sections that you want suppressed->suppress->x+2 and enter the following:

whileprintingrecords;
shared stringvar acct;
{table.acct} in acct

-LB
 
Thank you lbass

I will try this, but do I have to pass any subreport links like the Account Name{@acc-groups} and match it with the Account Name{@acc-groups} from the subreport link?
 
Why are you linking at all? If the sub is in the report footer, the only links you should potentially have are if you are using a parameter in both reports, and then you would link the parameters to each other.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top