So we return to this Nested Case statement folks, here my new problem:
I need to use a nested case statement but look for values in a >, <, or = to situation. I seem to be erroring out on this:
Select year({Employee.Hire Date})
Case 1996:
(Select {Employee.Salary}
Case > 75000:
{Employee.Salary} * 1.1)
Sure, post the error rather than just stating that you get one. Any tech suppport person would ask you this 1st off, please take the time to post the basics.
Try:
Select year({Employee.Hire Date})
Case 1996:
(Select {Employee.Salary} > 75000
Case true:
{Employee.Salary} * 1.1)
That's interesting, I will propose this in class tomorrow to my students. Here's another one (okay I didn't write the material BO did. I can't figure out why a global variable isn't seen all the way through a formula.
the first formula is the standard hire year, salary, raise:
local numbervar employee_hire_year := year({Employee.Hire Date});
global numbervar cost_of_living_increase;
local currencyvar employee_salary := {Employee.Salary} * (1 + (cost_of_living_increase/100));
select employee_hire_year
case 1996:
if employee_salary > 75000 then
employee_salary * 1.1
else if employee_salary >= 35000 then
employee_salary * 1.08
else
employee_salary * 1.06
case 1997:
if employee_salary > 45000 then
employee_salary * 1.09
else
employee_salary * 1.07
case 1998:
if employee_salary > 55000 then
employee_salary * 1.09
else if employee_salary >= 30000 then
employee_salary * 1.06
else
employee_salary * 1.04
case 1999:
if employee_salary > 70000 then
employee_salary * 1.1
else
employee_salary * 1.05
the Cost of Living is declared in another formula with a global variable and called in this formula. Here is the Cost of Living Variable:
global numbervar cost_of_living_increase := 2
If you use the variable after declaration in the first formula, instead of in the employee_salary variable, then its like CR doesn't see it. For example, after all variables are declared and the cost_of_living_increase is assigned .02
select employee_hire_year
case 1996:
if employee_salary > 75000 then
(employee_salary * 1.1)*cost_of_living_increase
else if employee_salary >= 35000 then
employee_salary * 1.08 *cost_of_living_increase
etc.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.