This is an old revision of the document!
Table Type
A table is a collection of tuples, where each tuple may be formed by several keys and values. The set of keys must be unique for each tuple.
![](/dinamica/dokuwiki/lib/exe/fetch.php?w=762&h=487&tok=4c9e9c&media=editors:table_basics_1.png)
![](/dinamica/dokuwiki/lib/exe/fetch.php?w=734&h=469&tok=03b298&media=editors:table_basics_2.png)
The set of all elements at the same position in all tuples defines a column. All columns must have a unique name. The names must follow the general name convention in Dinamica EGO, they must start with a “_” or a letter and must be formed by letters, numbers and underscores. Blanks in names are automatically replaced by “_” (underscore).
Keys and values can be represented using double precision floating point numbers, allowing the definition of integral and fractional values, or strings.
Internally, tables are represented using trees.
![](/dinamica/dokuwiki/lib/exe/fetch.php?w=711&h=545&tok=39d17d&media=editors:table_internals.png)
When stored as Comma-separated_values files, tables may also use the column name/type syntax to represent the column attributes — the name, the indication whether it is key or data/value column, and its data type.
GUI Editor
![](/dinamica/dokuwiki/lib/exe/fetch.php?w=755&h=509&tok=be94a1&media=editors:table_editor.png)
EGO Script
Tables are sequences of elements enclosed by [ ]. The keys/values are represented by real values or strings. The first line of the sequence specifies the column names. Column names suffixed by “*” represent keys.
[ "From*", "To*", "Rate", 1, 2, 0.4, 1, 4, 0.2, 2, 7, 0.5, 4, 8, 0.2 ]
The type of each columns is inferred inspecting the column elements. Elements representing strings can be surrounded by double quotes '“'.
[ "Categories*", "Name", "Color_Red", "Color_Green", "Color_Blue", 1, "soy", 20, 45, 125, 2, "rice", 20, 100, 125, 7, "coffee", 200, 45, 125, 12, "sugar_cane", 75, 45, 123, 34, "bean", 20, 45, 57, ]
The table below represents the table above without the use of double quotes.
[ Categories*, Name, Color_Red, Color_Green, Color_Blue, 1, soy, 20, 45, 125, 2, rice, 20, 100, 125, 7, coffee, 200, 45, 125, 12, sugar_cane, 75, 45, 123, 34, bean, 20, 45, 57, ]
Empty tables must provide the column types explicitly.
[ "From*#real", "To*#real", "Variable_Name*#string", "Upper_Range*#real", "Weight_Coefficient#real" ]
However, it is possible to omit the column type if the column type is “Real”. So, it is legal to redefine the previous table as the following:
[ "From*", "To*", "Variable_Name*#string", "Upper_Range*", "Weight_Coefficient" ]