Function Router1 extends this concept further; with the table functions of the .net library finaquant® protos like FunctionRouterA()
it is possible to apply selected table functions on selected subtables of an input table, as the examples below will illustrate.
The entity attributes (all the text and numeric attributes of an input table excluding subtable fields) determine which table function is to be applied on which subtable (sub-data of an entity).
Following scenarios may give you an idea about the use of function routers in practice:
- You want to calculate expected population of some cities in ten years from now depending on historical data like birth rate, population, migration rate and so on. You have an input table containing historical data for many cities, and depending on some attributes of the cities (entity attributes) like size (small, medium, big), altitude (low, high), average income category etc., you need to apply different formulas (table functions) for different cities to obtain the estimated population for each city in a result table.
- Scenario analysis: For the same scenario above, you may want to calculate the expected population for each city under different discrete scenarios like optimistic, realistic and pessimistic, and you may need to apply totally different formulas (or functions), each with its own set of additional parameters, to compute the expected populations for each scenario (see 2. example below).
- You want to calculate a performance measure for some financial assets, and for each asset group (entity attribute) you need to apply a group-specific performance function (table function). You have an input table containing data for multiple assets belonging to several asset groups, and you want to obtain the performance measure for each asset in a result table.
- For the same scenario above, you might have written your performance functions with another library for matrix computations like ILNumerics, R or matlab. You want to calculate the performance of each asset by feeding its subtable to its group-specific matrix function, provided that all the subtable fields are numbers; that is, either numeric attributes or key figures in the finaquant data structure (see 4. example below).
- You have some numbers like estimations, prices, costs etc. related with some entities like city, product, or invoice in a table. You want to check and validate these numbers, and generate warnings if something is wrong. For each entity-group you may need to apply a different set of validation functions (table or matrix functions). In that sense, a function router can also work like a rules engine! With the parameters of a function router you can set dynamically which validation functions are to be applied on which entities (see 5. example below).

- The term “function router” is first used by the author of this article in this context and meaning. [↩]