Trying to Get the System calculated Full Premium amount on CDF orders to Round Up automatically. Is this possible? I found Math.Round and some other options in the SDK but can't get any of them to work.
Field is PremiumCalulation_SimultaneousPremium
Round Up Full Premium
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Round Up Full Premium
You can do this with any decimal. Select does rounding to the nearest penny for display to the user but the field value internally has all the fractional pennies from the original calculation. To make sure the field has no fractional pennies, do the rounding before you set the field. As an example, the COR below rounds to the nearest penny.
If you wanted, you could even round to the nearest dollar.
Code: Select all
def SalesContract_SalesPrice_Value(args):
d = Decimal(100.505)
args.Value = Math.Round(d, 2, MidpointRounding.AwayFromZero) # 2 means round to 2 digits right of the decimal
# Output is "$100.51"
Code: Select all
def SalesContract_SalesPrice_Value(args):
d = Decimal(100.505)
args.Value = Math.Round(d, 0, MidpointRounding.AwayFromZero) # 0 means round to 0 digits right of the decimal
# Output is "$101.00"
Bob Richards, Senior Software Developer, SoftPro