I’m writing a clause where I need to calculate a percentage per month in a duration. If the output of that calculation isn’t a whole number I need to round off to two numbers after the comma and then finally use the fullnr function to output that number into its full text representation. I’m using the format-nr function to achieve that along with some conditional logic.
The issue I’m running into is that the format-nr function outputs text and fullnr only takes a number or currency as its parameter, resulting in an error.
Is there a possibility to convert it back to a number? Or would there be a better way to solve this issue?
I’ll include the code below:
CALCULATIONCLIFFVESTINGWITHOUTVESTINGAFTEREXPIRYTEXT = (
i.e.
, @fullnr(@CALCULATIONCLIFFVESTINGWITHOUTVESTINGAFTEREXPIRYROUNDED) percent (@CALCULATIONCLIFFVESTINGWITHOUTVESTINGAFTEREXPIRYROUNDED{“%”}) per month
CALCULATIONCLIFFVESTINGWITHOUTVESTINGAFTEREXPIRY = {100 / @months-in(#vesting^vesting-period)}
@CALCULATIONCLIFFVESTINGWITHOUTVESTINGAFTEREXPIRYROUNDED = {
@if(@CALCULATIONCLIFFVESTINGWITHOUTVESTINGAFTEREXPIRY != @round(@CALCULATIONCLIFFVESTINGWITHOUTVESTINGAFTEREXPIRY),
@format-nr(@CALCULATIONCLIFFVESTINGWITHOUTVESTINGAFTEREXPIRY, 2),
@CALCULATIONCLIFFVESTINGWITHOUTVESTINGAFTEREXPIRY
)
}