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

calculate grand total of shared variable in main rpt 1

Status
Not open for further replies.

namas

Technical User
Aug 31, 2006
31
US
Thanks much to you both.
I really appreciate your time and help.

I passed a shared numeric variable from
sub-report called 'BeginningBalance'
and placed it on the main report's
account group header.
The main report is grouped by account.
(Finally this part is working)

The report should display grand total
of all beginning balance.

year period account beginning_balance balance_debit balance_credit balance_amount YTDTotal
2006 1 1000 10.00 $110.00 ($55.00) $55.00 $60
2006 1 1001 20.00 $100.00 (100.00) 0.00 $20
2006 1 1002 30.00 $40 (10.00) 30.00 $60


1) How to calculate grand totals of shared variable in the main report?


2) The YTDTotal column = beginning_balance + balance_amount
How to calculate grand total of YTDTotal column?


following formula for YTDTotal works fine:

{@GetBeginningBalance} +
Sum ({gl_balance.balance_amt}, {gl_balance.account})


formula to calculate grand total of YTDTotal column
throws following error
Syntax: Sum( {@YTDTotal})
Error: The Summary / Running Total could not be created.

formula to calculate grand total of BeginningGrantTotal column throws following error
Syntax: Sum( {@GetBeginningBalance})

Error: The Summary / Running Total could not be created.
 
Add a variable to sum up the values, as in:

whileprintingrecords;
numbervar MyTotal:=MyTotal+{@GetBeginningBalance} +
Sum ({gl_balance.balance_amt}, {gl_balance.account});
{@GetBeginningBalance} +
Sum ({gl_balance.balance_amt}, {gl_balance.account})

Since you state that the above currently works, all you need is a variable to accumulate the total. The above also still shows the current value.

Display in the report footer using:

whileprintingrecords;
numbervar MyTotal

-k
 
Thanks. I am little confused with second line.
What it does exactly?

{@GetBeginningBalance} +
Sum ({gl_balance.balance_amt}, {gl_balance.account})
 
here's 1 minor problem I am having with
implementing shared variable 'BeginBalance'
from sub-report into the main report.

The main report and sub-report is linked by year, period and account.



Problem Case)

In sub-report some accounts may/may not have beginning balance
for some periods/year (timeframe).

eg. In year 2006, period 0, account 4000 may not have any balance in the gl_balance
table. So, there is no record in the gl_balance table for that account for that timeframe.


The problem in main report:

those accounts that doesn't exist in sub-report because they may not
have balance for that specific timeframe, in the main report,
the beginning balance for those accounts is displayed as beginning
balance of previous account.

eg.

year period account description account beginning balance

2006 1 Bus Passes 2161 476.22
2006 1 Parking 2162 726.44 749.81
2006 1 Other Liabilities 2180 -21,507.72
2006 1 Fees on Permanent Funds 4000 -21,507.72
2006 1 Fees on Permanent Funds-New Gifts 4001 -21,507.72
2006 1 Fees from Supporting Organizations 4010 -21,507.72


Here account 4000 and up accounts don't exist in sub-report because they do not
have any balance for 2006 period 1, but in the main report, the beginning balance
shows as balance from previous 2180 account.

How to fix this situation so that if there is no
beginning balance from sub-report, then it shows 0 in main report?
Any sugestions would be appreciated. Thanks.


The formula for shared variable 'BeginBalance'

whileprintingrecords;
shared numbervar BeginBalance
 
You should state technical information, such as where the subreport is in the main report and where you are displaying output, the rest is much less important.

Assuming that you have the subreport in some group, then you would create a reset of the variable PRIOR to running the report, as in:

whileprintingrecords;
Shared numbervar MyTotal:=0

Please, consider that we need to see your formula used and where the items you reference are located, showing output doesn't help much.

this formula:

whileprintingrecords;
shared numbervar BeginBalance

Does nothing but display, and you don't bother to state where that is in terms of it's section. Please be specific about what you use and where.

-k
 
Thanks, works perfect. Really appreciate your help!
 
Main report is grouped by account.

Sub-report is in Group Header #1a of Main report.
It is linked to the main rpt by year, period and account.

I noticed that in sub-rpt there are some accounts that have Beginning balance,
but those are not showing up in main report because those accounts don't
exist in main report for that time period.

eg. account 1000 have beginning balance of $10.00 in period 0, 2006. (this calculated in sub-report).
This account do not have any transaction in period 1, 2006.
In main report, if user selects period 1-1 for 2006,
since there is no transaction in Period 1,
this account is not displayed in main report
although it has beginning balance of $10.00 from period 0.


Ideally, it should display as:

year period account beginning_balance balance_debit balance_credit balance_amount YTDTotal
2006 1 1000 10.00 $0.00 0.00 10.00 $10

technical details:

period (accepts range values from 0-12) & year are parameter fields.

Record selection details in main report:

{gl_balance.year} = {?FiscalYear} and
{gl_balance.period} = {?FiscalPeriod}

Record selection formula in sub-report:

({gl_balance.year} = {?Pm-gl_balance.year}) and
{gl_balance.period} < Minimum ( {?Pm-gl_balance.period}) and
{gl_balance.account} = {?Pm-gl_balance.account}

What should I do to get the details from sub-report into the main report in such case?
with gratitude.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top