Table Type

A table is a collection of tuples organized in a special way, where each tuple may be formed by several keys and values. The set of keys in each row must be unique.

Table Basics
Table Basics

The set of all elements at the same position in all rows 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.

Table Internals
The Dinamica documentation and error messages usually express a table format as a sequence of column names/types separated by commas. For example, the sequence “City_Id*#real, City_Population#real, City_Name#string” corresponds to a table with one key column and two value/data column. The key column is named “City_Id” with type Real Value Type and the data/value columns are named “City_Population” and “City_Name” with types Real Value Type and String Type, respectively. It is also possible to omit the column names and represent that table format as “*#real, #real, #string”.

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

Graphical representation of the table editor

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"
]

Automatic Conversions