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

Selection within a Formula

Status
Not open for further replies.

szaunbr

Technical User
Jul 5, 2006
50
US
I am using CR9 with an Informix DB used for payroll. I have one report that contains several key pieces of info.

Location
Hours worked
Hourly Rate*
Job Code**
Pay Type code

* The hourly rate is different depending on the location.
** The Job code is different depending on the location.

The pay type code is always the same (151). The Job Code is one of two values (0190, 0192) depending on the location.

I need a formula that will multiply the hours worked by the hourly rate, but I need to pull the correct hourly rate based on the location.

How can I say:"If the location is XXX then use the hourly rate associated with job code 0192 and if the location is XX use the hourly rate associated with job code 0190??"

Any help will be appreciated. Thanks.
 
This is all a bit odd, you should supply example data and the expected output instead of trying to explain what the data looks like, it's much simpler and more clear.

If you have just one job code and location per, than why would you need to code anything?

I would think that you need to join the table to the payrate table.

You show what I believe to be what is required as output for the report, but not even a hint as to where this info comes from, except that it's Informix.

Please think your posts through, we don't know what your table(s) look like, whether grouping will be required, etc.

You can certainly use a formula such as:

If {table.location} = "XXX" then
{table.hoursworked} * {table.hourlyrate}
, but that's the same as what you've loosely described as the current structure.

-k
 
you want a formula field that says something like
if job_code = '0192' then hourly_rate

you also want one for the other job code.
Then for your main formula

if location = xxxx then
{tablename.hoursworked} * {formula for 0192}
else if location = xxxx then
{tablename.hoursworked} * {formula for 0190}

i may have got the wrong end of the stick, appolagies if i have!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top