
1. Re: Calculate a new price in whole dollars
Orlando May 22, 2017 6:32 AM (in response to neildecort)Hi neildecort,
Just start by saying if you can, move this post to general discussion, you will have more people see and get back to you with a solution.
On that note, I am not sure if you need to change the result in any way, but if you are trying to do a straight currency conversion from USD to CAD then you do not need the Case statement that is changing the outcome and causing the $@@.95 price value.
You could try simplifying it with the following
If ( isEmpty (PriceAmount02 ) ; "" ;
Let (
convertedAmount = ( PriceAmount02 * Priceamount06exchangerate ) ;
Round ( convertedAmount ; 2 )
) )
Hope this helps
 Orlando

2. Re: Calculate a new price in whole dollars
beverly May 22, 2017 6:34 AM (in response to neildecort)TSPigeon may wish to move this to the Discussions space for other to more easily see it.

3. Re: Calculate a new price in whole dollars
neildecort May 22, 2017 6:59 AM (in response to Orlando)Hi,
I tried this, but it rounds to 0.54 and 0.94, rather than 0.95, I', afraid.
As for moving to the General, great idea but I'm not sure how (apologies for incompetence!)

4. Re: Calculate a new price in whole dollars
philmodjunk May 22, 2017 7:52 AM (in response to neildecort)I can't see how I can adjust this so that a $@@.95 USD price gives a $@@.95 CAD price, and a $@@.00 USD price gives a $@@.00 CAD one.
I can't see how, doing that could possibly be a correct conversion of these values.
I think that you'll need to provide more info as this requires changes to what is otherwise a very simple algorithm for converting currency.

5. Re: Calculate a new price in whole dollars
Orlando May 22, 2017 8:08 AM (in response to neildecort)So do you need the result to always be either a $##.00 or $##.95 value?
Looks like the original calculation is always rounding up or down to .95, if this is correct and you want to amend it so if you input a $##.00 value the result is rounded to $##.00 then maybe this will do the trick.
If ( IsEmpty ( quickTest::PriceAmount02 ) ; "" ;
Let( [
convertedAmount = ( PriceAmount02 * Priceamount06exchangerate ) ;
remainder = Mod ( convertedAmount ; 1 ) ;
isWholeNumber = Mod ( PriceAmount02 ; 1 ) = 0 ;
amend = Case ( isWholeNumber = 1 ; 0 ; remainder > .475 ; .95 ; .05 )
] ;
Round( convertedAmount  remainder ; 0 ) + amend
))
If not then some examples of input, rate and expected output values will be helpfull to understand what you are expecting.
 Orlando

6. Re: Calculate a new price in whole dollars
neildecort May 25, 2017 2:34 AM (in response to Orlando)This has done it, thank you; a .95 input converts to a .95 output and a .00 input gives a .00 output, just what I needed, thank you very much!