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!

Runing total issue - need to total a running total calculated sum

Status
Not open for further replies.

agray123

Technical User
Mar 4, 2002
110
US
using this:

if {@variablenextdate}>{TRAVEL.ENDDATETIME}then datediff('d', {TRAVEL.BEGINDATETIME},{TRAVEL.ENDDATETIME}) else
if{@variablenextdate}=date(0,0,0)then DateDiff ('d',{EXPENSEDETAIL.ARRIVEDATETIME} ,{TRAVEL.ENDDATETIME} )else
DateDiff ('d',{EXPENSEDETAIL.ARRIVEDATETIME} ,{@variablenextdate} )

to get a datediff of selected travel times - then multiplying this by Subsistence rate and then (hotel)Rate in separate formulas to get a per group total - but then I need to summarize all of these into one amount -

i.e 2/3/2 days at 330/135/253 per day = 660+405+506= 1571

I have arrays to calculate the 2/3/2 and the 330/135/253 -

Can I get the calculations from there - will send array coding if necessary.
 
I had responded to this earlier, but the system blew...

You should be able to use summaries to do all of this rather than arrays.

Try posting example data and expected results.

-k
 
thank goodness you are here for the rescue.....let me get you a datasetup - it is plenty full of issues
 
Ummm, OK.

When you have a formula that's returning a value at a group level, you can place it into a summing variable for display later:

For instance you have

sum({@formula},{table.group})*1000

in your group footer.

You could use this formula at the group level to sum it:
Numbervar SumNum;
SumNum:=SumNum+sum({@formula},{table.group})*1000

Then this would display it in the group footer:
Numbervar SumNum

Without specifics I can't really help you further with this.

-k
 
OK - got some things done - now for the data -

10/4/2004
Golf Fees 329.98 55.37
Airline 329.98 55.37
Car Rental 329.98 55.37
Rental Car Gas 329.98 55.37
Registration Fees 329.98 55.37
Parking & Tolls 329.98 55.37
Train / Subway 329.98 55.37
Membership Fees 329.98 55.37
Taxi 329.98 55.37
Boat Cruise 329.98 55.37
2.00 659.96 10/6/2004 5:00:00PM

10/6/2004
Golf Fees 134.76 29.47
Airline 134.76 29.47
Car Rental 134.76 29.47
Rental Car Gas 134.76 29.47
Registration Fees 134.76 29.47
Parking & Tolls 134.76 29.47
Train / Subway 134.76 29.47
Membership Fees 134.76 29.47
Taxi 134.76 29.47
Boat Cruise 134.76 29.47
0.00 3.00 404.28 10/9/2004 6:00:00PM

10/9/2004
Golf Fees 252.98 55.22
Airline 252.98 55.22
Car Rental 252.98 55.22
Rental Car Gas 252.98 55.22
Registration Fees 252.98 55.22
Parking & Tolls 252.98 55.22
Train / Subway 252.98 55.22
Membership Fees 252.98 55.22
Taxi 252.98 55.22
Boat Cruise 252.98 55.22
0.00 7.00 1,770.86 10/27/2004 7:00:00

Left out the amounts for the golf fees etc because I already have them - the issue is that I am trying to get the subsistence rate and hotel rate (55.22 and 252.98) multiplied by the datediff: shown above (7.00 days) resulting in a 1,770.86 sum to be summed again with the other summaries from the rest of the travel.

I cannot make this happen right now by hook or crook - since I do not have a travel depart date other than the first day, I have had to use the previous/next arrive date in formulas - which pushes me past the ability to sum a sum ....I think
 
I just tossed in the *1000 as an example, it multiplies the sum *1000, much as you were intending to use sums in formulas.

Why do you have multiple posts going?

-k
 
I was asking a question on the one post to see if I could grab the table fields and split them - but I wasn't sure if I could do that - I really need to pass this data down after it has already been caclulated -as the number of days travel varies, as does the subsistence and lodging rate

I really would rather be in one post at a time - especially since I am a bifurcated blogger.

 
<laffin>

Bifurcated blogger, that must be a kewl thing, it certainly sounds like one.

So, what do you need now?

You have examples of variables storing data for display later.

BTW, your data looks like the results of data, not data. Data is genrally stored in table structures. Is this the intended output, or?

-k
 
Data is stored poorly - as this is a customized bolt on piece to a crappy CRM module.

TRAVEL.tbl contins Begin date and end date, travel id
EXPENSELIST.tbl contains Travel ID (linked),cost type -and amount
EXPENSEDETAIL.tbl contains Travel ID , Rate and Subsistence.

I have had to fudge the date time calculations since I was not provided with depart date. My report is loaded with variables already - however in this case, I am unable to pass anything from the Rate_calc formula:
{@DATEDIFF}*{EXPENSEDETAIL.RATE}
Date diff is included above - multiplying this times the rate gives me the fielsd I can do nothing with - other than to admire that I was even able to get this far.


Intended out put shoudl look like this - I have arrays to get the 2/3/2 data and $$/$$/$$ data

Estimated Lodging for 2/3/2 days at 55/110/55 $550.00
Estimated Subsistence for 2/3/2 days at 40/70/28 $346.00




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top