Thanks for the post.
This one is a simple "If".
your calculation would be:
If(CodeTable::Code="008";RecieptTable::Amount * 1.05;RecieptTable::Amount)
how does that do for you?
That works perfectly for the amount that I want to percentage to show. but I would also like if the other codes which to not have the 5% calculated, for the amount not to show or for it to show a zero in that field.
Right now the calculation is perfect
I have 94.00 for a receipt and I have Surcharge fee as 4.70 if it has code 008, but then I have a receipt for 50.00 for code 009 and it shows up in the surcharge fee calculated feild as 50.00.
Is there a way to have this field be blank if it doesnt meet the 008 requirement? or have it calculate to 0.00 instead of the receipt price if it doesnt meet the code if statement.
Sure thing sweetcuda,
Think it through with me here...the "If" statement works like this:
If( Test This ; Do this if it's true ; Do this if it's false )
If(CodeTable::Code="008";RecieptTable::Amount * 1.05;RecieptTable::Amount) returns Amount*1.05 if it's true and Amount if it's false.
If you want to change what happens when the test Code="008" is flase, then do so.
If(CodeTable::Code="008";RecieptTable::Amount * 1.05;"0" ) returns "0"
If(CodeTable::Code="008";RecieptTable::Amount * 1.05;"" ) returns a blank
If(CodeTable::Code="008";RecieptTable::Amount * 1.05;"sweetcuda" ) returns "sweetcuda"
Is this what you're after?
Thank you so much for your help and the wonderful explination. I have never really worked with calculations and your explination was so helpful. You are Awesome!!!! I love the sweetcuda return for one of the calculations. LOL
How would I write an if statement for two different charge codes.
I have the "008" which I have calcuating at 0.0842 (works great)
But now I also want the same field to calculate if a charge code is "009" to multiply the dollar amount by 0.05.
I tried just adding Or to the end of this statement
If(CodeTable::Code="008";RecieptTable::Amount * 0.0842;"0" ) Or If(CodeTable::Code="009";RecieptTable::Amount * 0.05;"0" ) but it is not coming up with the correct number.
For multiple IF's, you'll have to do multiple IF statements by replacing our If;Then;Else with If;Then; (Else=If;Then;Else)
In other words, if true, do this...if not true, check if THIS true, do that...
If (CodeTable::Code="008";RecieptTable::Amount * 0.0842; <-- this is the first IF
If (CodeTable::Code="009";RecieptTable::Amount * 0.05 <--- this is the second IF (also the first "else)
"0" )) <--- This is the final "ELSE"
You can nest in many of these if needed. There is also a "Case" function that does a very similar function as well.
Does this get you where you're going?
Outstanding, that worked perfectly. Do you have a suggestion on a good book to use to learn how do to this type of coding or script writing?
If you can find a library or bookstore that has books old enough, I find that some of the best conceptual references tend to be BASIC or FORTRAN reference books from the '70s and '80s.
Scripts (to my eyes anyway) are little FORTRAN programs that run in the background. Mac folks may say the same thing whilst switching in the word "Applescript" for FORTRAN.
For actual current resources, I'll let someone else on the forum give guidance...I'm a self-taught muddler so I'm not familiar with the best current resources.