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!

declaring variables

Status
Not open for further replies.

RWahlert

MIS
May 17, 2004
51
US
I am working on a commission report where the commission paid is based on the profit margin of the product sold and the products the salesmen sells. The higher the margin the higher the commission and if the salesperson is responsible for product line 1 his commission levels are X if a different salesperson is responsible for product line 2 his commission levels Y.

I would like to write a variable declaration formula that looks like this:

numbervar commission1
numbervar commission2
numbervar commission3
numbervar commission4

If "salesterritory" = ProductLine1 Then

commission1 := 0.05
commission2 := 0.1
commission3 := 0.15
commission4 := 0.20

Else

commission1 := 0.025
commission2 := 0.05
commission3 := 0.075
commission4 := 0.01

However I always get errors stating that the remaining text does not appear to be part of the formula. Is my idea possible?

Thanks.
 
Hi,
Place a ; after each variable assignment statement inside the If...Then..Else clause..




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Try:

numbervar commission1;
numbervar commission2;
numbervar commission3;
numbervar commission4;

If "salesterritory" = ProductLine1 Then
(
commission1 := 0.05;
commission2 := 0.1;
commission3 := 0.15;
commission4 := 0.20;
)

Else
(
commission1 := 0.025;
commission2 := 0.05;
commission3 := 0.075;
commission4 := 0.01;
)

-LB
 
Thanks for responding.

I had already tried that. When I check the formula for errors Crystal highlights everything from "else" on down and displays the error I mentioned.

 
You have to add the parens as in my post.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top