Reference Variable

Discussion created by cmj on Jan 14, 2018
Latest reply on Jan 14, 2018 by philmodjunk

I was speaking with a developer friend of mine who enlightened me with what he called a common method used in programming where a variable changes it's value depending on where it's being applied. I had mentioned that the project I'm working performs a high number of repetitive calculations that are basically the same except for the period in time that each calculation performs.

e.g. for illustrative purposes - 3 separate calculations:

Expense * Inflation^ Year2 - Year1/365 (result stores in Field 1)

Expense * Inflation^ Year3 - Year2/365 (result stores in Field 2)

Expense * Inflation^ Year4 - Year3/365 (result stores in Field 3)


From what I understood, he said using a reference variable would only require 1-instance of the calculation code and  the variable(s) would change each time it looped through the required number of calculations. The result of each calculation could be written into a field. In this example the variables would reference existing fields that determine the periods:

Year2 and Year1

Year3 and Year2

Year4 and Year3


Is there anything similar to a reference variable in FM that can be used to perform a chain of calculations. The big advantage to this is the need for a single calculation vs numerous iterations that are hard to maintain and are prone to errors.


Thank You