====== Working with Tables ====== ===== Introduction ===== Dinamica EGO 2.2 introduced a new table type called [[Table Type]]. Tables are a very flexible way to represent model inputs and outputs. Unlike the [[Lookup Table Type]], Tables can contain several columns, each how can be indexed by several keys and it is possible to store real numbers and strings. ===== Calculating Areas ===== To highlight the benefits of using Tables, let's start changing one of the tutorial lessons to use table to calculate areas more effectively. The [[tutorial:incorporating_iterations_into_a_model|original lesson]] uses a loop to calculate the forest area for each one of the Amazon states. But what if we want to calculate the are of all land-use classes for each state? Using Lookup Tables we were forced to use several Muxes to keep track of the area of each land-use class individually. This does not scale very well because the addition of new classes to the input map requires changes to the model itself. Tables provide a better solution to this problem. I suggest the customization of the functor "alias" used by the functor in the model. They make the model easier to read and interpret.