Robbydobbs Posted May 1, 2003 Posted May 1, 2003 I have a field sales tax. I need a good calculation for this field. The calculation has to say: If the description field is occupied and the dealer license field is occupied then don't charge sales tax, or if the misc description field is occupied and the tax exempt field is occupied then don't charge sales tax or if the field "sales tax" which is a value list with yes/no and the answer is "No" then done't charge sales tax other wise add the price plus buyers fee together then times by .066. case( not isempty(t_desc) and not isempty(t_dealerlic), 0, (not isempty(t_miscdesc)and not isempty (t_taxexempt), 0, t_salestax = "No", 0, (n_price + n_buyerfee) * .066 ) What I'm trying to say is if t_desc is not empty and t_dealerlic is not empty then charge "0", or if t_miscdesc is not empty and t_taxexempt is not empty then charge "0", or if t_salestax = "No" then charge "0", otherwise charge the (n_price to n_buyerfee) * .066. Could I get some help on this calculation?
Fitch Posted May 1, 2003 Posted May 1, 2003 Perhaps you want this: case( (not isempty(t_desc) and not isempty(t_dealerlic) or (not isempty(t_miscdesc) and not isempty (t_taxexempt)) or t_salestax = "No", 0, (n_price + n_buyerfee) * .066 ) The way you wrote it, if the first condition evaluated to "true" you'd get 0, even if t_salestax was set to "Yes." This way you get 0 if any one of those 3 things is true.
Lee Smith Posted May 2, 2003 Posted May 2, 2003 Hi Tom, I getting too many separators at the "No" spot? Lee
Ugo DI LUCA Posted May 2, 2003 Posted May 2, 2003 That's fine, just add " ) " to < not isempty(t_dealerlic) > ...not isempty(t_dealerlic) ) Tom is not that lazy guy with Copy/Paste from the computer
Fitch Posted May 5, 2003 Posted May 5, 2003 Good catch, Ugo. (You don't expect me to actually TEST these things, do you?) (this and that) or (this and that) or this and (that or this) and that Now, assuming we've got the parentheses where they belong -- I'm not even certain that they are strictly necessary. But when in doubt, why not err on the side of safety? IMO it also makes the logic easier to read when you look at it later.
Recommended Posts
This topic is 7943 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now