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

Sum only a Portion of a Record Set 1

Status
Not open for further replies.

szaunbr

Technical User
Jul 5, 2006
50
US
Hello. I am working with CR9 and am using a informix db via an odbc connection and linking that to a csv file.

I am only using one table from my database and it has two columns. One column is type, and the other is balance.

I am dealing with leave balances and types. We have 3 types of absences.
1. Sick
2. Accumulated Sick
3. Vacation

Each of these has a type (1,2,or 3) and a correcponding balance. The csv file contains absences throughout the month. This file is created externally and then sent to me.

Here is an example of one employee:
Employee 1 has 10 sick days and 15 accumulated sick days. He uses 20 days one month. I need to reduce first his sick days (type 1) by 10 days and then reduce his accumulated sick (type 2) by the remainder. After all of this takes place his balance in type 1 will be 0 and type 2 will be 5.

I would like to do the following with a formula but am not sure how to get started.

The formula should display the balance for vacation days(type 3) as is, straight from the db.
For sick days, it should result in the addition of the balance from type1 and type2.

Not sure how to get started with this formula.

Any help will be appreciated.

Thanks.
 
Do running totals for each of the types. Then do a formula that adds or subtracts them. Display the running totals initially, just to be sure they are working as expected.

If you're not already familiar with Crystal totals, the basics are explained at FAQ767-6524.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thank you. That worked fine. I knew there was a way.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top