I am not sure this is even possible but, I have a table that includes the following data, and would like for it to return the Total Rent for each year including the Escalation amount (1.5%). If possible, would the right function be an Iterator? I am lost with this one, any help would be appreciated. Thanks
$Feature.Sqft_Total = 1000
$Feature.Price_Per_SQFT = $3.00
$Feature.Number_Of_Years = 10
$Feature.Escalator = 1.5%
All Feild Types are Numbers
I would like to insert a Calculation Rule to concatenate the following:
Year 1: $3,000.00 Formula = ($3.00 * 1000)
Year 2: $3,045.00 Formula = (($3.00 * 1.5%) + $3.00) * 1000
Year 3: $3,090.68 Formula =
.
Year 10:
Solved! Go to Solution.
This will give you the expected output (checked with a compound interest calculator)
var Sqft_Total = 1000;
var Price_Per_SQFT = 3.00
var Number_Of_Years = 10
var Escalator = 1.5
var total = Sqft_Total * Price_Per_SQFT
var output = `Year 1: ${Text(Round(total, 2),'$#,###.00')}`
for (var i = 2; i <= Number_Of_Years; i++) {
total = total * (1 + Escalator/100)
output += `${TextFormatting.NewLine} Year ${i}: ${Text(Round(total, 2),'$#,###.00')}`
}
return output
which returns this
"Year 1: $3,000.00
Year 2: $3,045.00
Year 3: $3,090.67
Year 4: $3,137.04
Year 5: $3,184.09
Year 6: $3,231.85
Year 7: $3,280.33
Year 8: $3,329.53
Year 9: $3,379.48
Year 10: $3,430.17"
This will give you the expected output (checked with a compound interest calculator)
var Sqft_Total = 1000;
var Price_Per_SQFT = 3.00
var Number_Of_Years = 10
var Escalator = 1.5
var total = Sqft_Total * Price_Per_SQFT
var output = `Year 1: ${Text(Round(total, 2),'$#,###.00')}`
for (var i = 2; i <= Number_Of_Years; i++) {
total = total * (1 + Escalator/100)
output += `${TextFormatting.NewLine} Year ${i}: ${Text(Round(total, 2),'$#,###.00')}`
}
return output
which returns this
"Year 1: $3,000.00
Year 2: $3,045.00
Year 3: $3,090.67
Year 4: $3,137.04
Year 5: $3,184.09
Year 6: $3,231.85
Year 7: $3,280.33
Year 8: $3,329.53
Year 9: $3,379.48
Year 10: $3,430.17"
You are amazing, thank you!
Would it be possible to return the sum? Thanks again.
Sure. This adds the sum to the bottom of the list
var Sqft_Total = 1000;
var Price_Per_SQFT = 3.00
var Number_Of_Years = 10
var Escalator = 1.5
var total = Sqft_Total * Price_Per_SQFT
var sum = total
var output = `Year 1: ${Text(Round(total, 2),'$#,###.00')}`
for (var i = 2; i <= Number_Of_Years; i++) {
total = total * (1 + Escalator/100)
output += `${TextFormatting.NewLine}Year ${i}: ${Text(Round(total, 2),'$#,###.00')}`
sum += total;
}
return `${output} ${TextFormatting.NewLine}Sum: ${Text(Round(sum, 2),'$#,###.00')}`