Newbies hstrom Posted January 12, 2010 Newbies Posted January 12, 2010 Hi, I have encountered a big problem in the Case function, that I hope someone has an intelligent solution to... I am start to suspect a bug in the great FM.. I am programming a price enquiry tool for book printing, and needs to set up multiple conditions to get a correct price. The first Case function is regarding the amount of pages in the book, more or less x number of pages. The result consist of another Case function, which takes the amount of books to be printed into consideration when calculating the price. So, lets say that the first case function notices that the number of pages is less or equal to 50, then the second case function needs to see what amount of books should be printed and has five conditions to choose from and calculate a result depending on this. The problem is that the second case function's first two conditions is working perfectly, but the last three conditions is working wrongly.. This is the code: Case ( Number of pages ≤ 50 ; Case ( Amount of books ≥ 1 and Amount of books ≤ 49 ; Price up to 50 pages and up to 49 copies ; Amount of books ≥ 50 and Amount of books ≤ 99 ; Price up to 50 pages and up to 99 copies ; Amount of books ≥ 100 and Amount of books ≤ 149 ; Price up to 50 pages and up to 149 copies ; Amount of books ≥ 150 and Amount of books ≤ 199 ; Price up to 50 pages and up to 199 copies ; Amount of books ≥ 200 ; Price up to 50 pages and over 200 copies ; 0 ) ... [continueing with other page ranges] ;0 ) This should - according to my expertize... - give me a price for all amount ranges 1-49, 50-99, 100-149, 150-199 and above 200. But, as said, it functions ok for the two first amount ranges, the third, fourth and fifth range isn't calculated on the specific field with the price (for example the field "Price up to 50 pages and up to 149 copies"), but instead it uses the result 1 field, "Price up to 50 pages and up to 49 copies"... What is wrong with this code? Can someone tell me, I would very much appreciate it! With kind regards, - Johan.
Newbies hstrom Posted January 12, 2010 Author Newbies Posted January 12, 2010 I am extremely stupid - I am sorry... The problem, which I noticed after like 4 hours of debugging this was that one of the field was a text field, not a number field... What a shame.. With kind regards, - Johan.
comment Posted January 12, 2010 Posted January 12, 2010 Some specific examples of input and result would be helpful. Offhand, I'd suspect that Amount of books is a Text field.
bruceR Posted January 13, 2010 Posted January 13, 2010 This should be done with a price table and lookup, not a calculation.
Recommended Posts
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