If / Then Calculations
Hi, I am trying to create a calculation field that helps calculate the total for a renovation for a home depending on a selection of both A. Major Repairs Needed and B. Condition of the Property.
The user selection from a list, multiple choice option, to select the repairs needed for the home. Each Repair has it's own prices, i.e, HVAC = $2000, Roofing = $4000, Foundation = $8000, etc.
Then the user will select a single choice option of the condition of the property. Each condition has a calculation of Lite Repair = $10 * sqft, Medium Repair = $20 * sqft, Heavy = $30 * sqft.
I want a final calculation based on the choices in A and the choice in B. Would anyone be able to help formulate this?
-
var repairs_needed = @Repairs Needed;
var conditions = @conditions;
var sq = @Square Feets;
var object_rn = {
"HVAC":2000,
"Roofing":4000,
"Foundation":8000
}
var object_con = {
"Lite Repair":10,
"Medium Repair":20,
"Heavy":30
}
var sum_rn = 0;
for(var i = 0; i < repairs_needed.length; i++){
sum_rn += Number(object_rn[repairs_needed[i]]) || 0;
}
sum_con = Number(obj_con[conditions]) * Number(sq);
sum_rn + sum_conIn obj_rn and obj_con add all categories from your categoriy fields with their value
Please sign in to leave a comment.
Comments
1 comment