Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...(I) have been able to get my problems solved from past messages and also new posts that other users have responded to promptly..."

Geography

Where in the world do Tek-Tips members come from?

How to evaluate a value in a formula and based on the result execute another formula -

MrFuzzwah (MIS)
13 Jul 12 12:24
I have a formula in a subreport that assigns a running total to a variable which is passed to the main report:
// FICA
whileprintingrecords;
shared currencyvar FICA;
FICA:={#FICA}

I have another formula (not a running total) in the main report to calculates another value:
whileprintingrecords;
//CORRECT_FICA
{@CALC3 (TAXBLE-OJI) - NONTAX} * .042

If the result of the first formula is zero the second needs to be zero. I need to look at the result of the first formula and if it is 0 I need to move 0 to the result of the second formula. Notice the second formula does not use any field from the first formula directly.

I can't get it to work. If you can assist - believe me your help is appreciated.
MrFuzzwah (MIS)
13 Jul 12 12:53
The two formulas as distinct - they do not share any fields. But - if the result of the first formula is 0 then the second needs to be zero.
lbass (TechnicalUser)
15 Jul 12 16:40
You have to reference the shared variable in your second formula, like this:

//CORRECT_FICA
whileprintingrecords;
shared currencyvar FICA;
if FICA=0 then
0 else
{@CALC3 (TAXBLE-OJI) - NONTAX} * .042

-LB
MrFuzzwah (MIS)
20 Jul 12 12:58
I have 2 subreports as shown below:

whileprintingrecords;
shared currencyvar HOURS;
HOURS:=Sum ({PAYROLLDB_EVENT.HOURS});
HOURS

whileprintingrecords;
shared currencyvar RATE;
RATE:={PAYROLLDB_EMP.EMPRATE};
RATE

I'm trying to multiply these two to be inserted into my main report. I have tried to format them in a million ways and move them around to various section with no luck. All I'm trying to do is multiply two values!

whileprintingrecords;
shared currencyvar HOURS;
shared currencyvar RATE;
HOURS * RATE

As usual - does anyone know why this simple thing would not work?

pmax9999 (TechnicalUser)
20 Jul 12 20:19
Hi MrFuzzwah

What result are you getting?
The calculation must be in a section below the subreports. Are they?
Also, the subreports can not be suppressed - if it is the subreport will not get executed.

In the formula in the main report, change it to display firstly HOURS and then RATE to ensure the values are being returned from the subreports.

Hope this helps

Cheers
Pete
MrFuzzwah (MIS)
25 Jul 12 11:38
Thank for for responding Pete and Lbass. I got is resolved by changing the logic. Actually - it came rather suddenly that I saw a different way to approach it. Thanks again.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close