1 Reply Latest reply on Mar 8, 2013 9:06 AM by philmodjunk

# Need help with the Case function

### Title

Need help with the Case function

### Post

Would appreciate any help with a problem creating a correct Case function.

Here's what I have, followed by a description of what it's supposed to do:

Case
( Number of Days <=28;Choose (Number of Guests ; 0; 20; 35; 45.5; 56);

Number of Days ≥ 28;Choose (Number of Guests ; 0; 17; 30;40.5;51);

Number of Days  ≥ 42;Choose (Number of Guests ; 0; 16; 28; 38; 48);

Number of Days ≥ 56;Choose (Number of Guests ; 0; 15; 26; 35; 45);

+(Number of Guests*Number of Days)+Other Fee-Credit)

What it is supposed to do is perform a calculation based on:

-a- If less than 28 days, calculate the Number of Days multiplied by the Number of Guests (1 guest = \$20, 2 guests = \$35, 3 guests = \$45.5, 4 guests = \$56).

-b- Then if the Number of Days is equal to or greater than 28  days but less than 42 days, the next rates are \$17, \$30, \$40.50, \$51

-c- Subsequently, if the Number of Days is equal to or greater than 42 but less than 56 days, the rates applied are \$16, \$28, \$38, \$48

-d- And finally, if the Number of Days is equal to or greater than 56, the best rates given are \$15, \$26, \$35, 45 - again corresponding to the Number of Guests.

The problem is that the database is only recognizing/reading the first two arguments (-a- and -b-) and ignoring the last two.

• ###### 1. Re: Need help with the Case function

Case goes with the first boolean expression to evaluate as True. for any number of days greater than 28, the second boolean expression, Number of Days ≥ 28 will evaluate as true.

Case
( Number of Days <=28;Choose (Number of Guests ; 0; 20; 35; 45.5; 56);

Number of Days < 42;Choose (Number of Guests ; 0; 17; 30;40.5;51);

Number of Days  < 56 ;Choose (Number of Guests ; 0; 16; 28; 38; 48);

/* else */ Choose (Number of Guests ; 0; 15; 26; 35; 45);

+(Number of Guests*Number of Days)+Other Fee-Credit)