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

Calculating sum based on level nos

Status
Not open for further replies.

Smitha08

Programmer
Jan 31, 2008
19
US
Hi,

I want to print a report which has the following fields

Desc lvl Amount
Text1 2 20
Text2 2 30
Text3 3 50 ..this being sum of all 2
Text4 2 10
Text5 2 20
Text6 3 30 .. sum of all 2 till last 3 lvl
Text 7 4 80 sum of all 3s

There are 12 levels like this any idea how i can go ahead.. i do not want to create 12 fields for the amount totals as there are 7 columns like this for totals.

Thanks,
Smitha
 
It is unclear what fields in your sample are existing database fields. What does your data look like if you place it in the detail section of your report?

Is the "text" an actual database field? Please show some actual results for this field. It is unclear what you are having trouble with. Is the indentation the issue? Getting the summary data?

-LB
 
Thanks lbass

To answer your question
Report looks like this
If lvl is 2 then amt is print as it is
if lvl is 3 then sum of 2's till next 3 at end are calculated( sub-total)
if lvl is 4 then sum of 3's till the next 4 is calculated

detail currently has the text ie., the description of account and then the sales amount.
subtotal of all 3's till that 4 , for the 4th level all 4's for the 5'th level, till that 5's so on and so forth 11 levels.

Sales
545-21 Japan to N. America 0.00 0.00
545-22 Other to N. America 0.00 0.00
545-28 Within N. America 0.00 0.00
Total Subsidiary Agency Sales 0.00 0.00
Total Transaction Volume 0.00 0.00
 
You have not identified the names of your fields here, so I don't know what I'm seeing. What is the group structure of the report? Please use actual field names in identifying groups.

-LB
 
sorry lbass for being unclear.
hope this is clear.

Based on the level's the sum is calculated.
if lvl is 2 nothing is done its written as it is
if lvl is 3 then sum of all 2's till 3 is encountered .
Current Period
Petty cash 20.00
Current Deposit 30.00

=Total current assets 50.00
A/R 20.00
Loan to employee 30.00
=Loans 50.00
==Total current assets 100.00

indentaion and spacing is all done and working fine.. Now all i have to do is calculate sum based on levels.

thanks,
smitha
 
You still didn't explain your groups or what fields they are based on. Anyway, let's say that each of your "levels" represents a group. You can use a running total that does a sum of {table.amt}, evaluates for each record and resets on change of group: level 3. For the next higher level, insert a new running total with the reset on change of group: "level 4". For the grand total, set it up the same way, but with reset: never.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top