Cognito-forms – Trying to do a calculation with a Choice field and Decimal in Cognito Forms

cognito-forms

I'm trying to make a calculation with a selected value in a choice field in combination with 2 other Integer fields. I created the following code:

`Calculation 1 = a text type
Choicefield = a dropdown/with several predefined values
Value 1 = a Integer Type number field 

=(if Choicefield ="Choice1" and Value1 <3 then 72 * Value1 else if    
Choicefield = "Choice1" and Value1  >2 and Value1 <5 then Value1 * 67.5 else if 
Choicefield = "Choice1" and Value1 >4 and Value1 <10 then Value1 * 63 else if 

Choicefield = "Choice2" and Value1 <3 then 80 * Value1 else if 
Choicefield = "Choice2" and Value1 >2 and Value1 <5 then Value1 * 75 else if 
Choicefield = "Choice2" and Value1 >4 and Value1 <10 then Value1 * 70  
So on for the other choices.....
else "")`

I have a second calculation field:

Calculation 2 = a number type
Value2 = a Integer type Number field
=Value2 * 0.35

In my last field I want to add the values from Calculation 1 and Calculation 2 together:

Calculation 3 = a Number Type
=Decimal.Parse(Calculation 1) + Calculation 2

The issue exists when trying to multiply with the decimal value
67.5 in my first calculation. As you can see if I enter 3 in my value1 field the calculation would be 67.5 * 3 = 202,50 however, in my third calculation field "2.025,00" is shown instead of 202,50.
How do I calculate with decimals in my first calculation field so the correct price is shown in my final calculation (3) field?

Best Answer

The issue resolved after I changed my first calculation field into a Number type. Earlier this resulted into an error, as you can see in my example above at the end of the code I close with a string 'else "" ' instead of a number 'else 0' which caused the error.

It is also unnecessary to parse calculation 1 into a decimal in Calculation 3.