Fact tables#
A fact table is a table or a view of the database that is analyzed: the invoices, their lines, the customers, the incidents. Each one has an alias, which is the name users see, and its dimensions and metrics. They are registered from the catalog, in the editor's Structure tab.
Before you start#
- You need Metadata administration.
- The connection's catalog has to be read and contain the table. If you do not find it, refresh the catalog (see The database catalog).
Which table is a fact table#
Normally one fact table is registered for each database table that is not a simple code table. A code table with more data than the code and the description (products with their price, their brand and their family; sales reps with their zone and their manager) is best registered also as a fact table: this way its own data can be analyzed, and the same table keeps serving as the auxiliary table of the dimensions that name it.
Views work the same as tables. A view without a primary key does not support lists and is not edited in forms, but it is queried (in the demonstration, V_VENTAS_MENSUALES).
Register fact tables#
- In Structure, click New fact table….
- In Step 1 of 2 · Catalog tables, check one or more tables. Those that are already fact tables cannot be chosen. Click Next.
- In Step 2 of 2 · Alias and options, choose the options (below) and type the alias of each table. Below each one, the dialog says what will be created: “12 dimensions and the metric “Número de Facturas”, in the “Facturas” folder of the presentation tree”.
- Click Create 1 table (or Create 3 tables).
- The dialog creates the tables one after another and says which have been created and which have not, with the reason. Click Close.
On closing, the tree shows the first table created with its panel open.


The creation options#
| Option | What it does |
|---|---|
| Create its folder in the presentation tree | Creates a folder with the table's alias and places its dimensions and metrics in it. Checked by default. Uncheck it for a table that is only used for calculations or relationships. |
| Dimension names with initial capitals | Each dimension takes the name of its column. With this option, with initial capitals: TIPO_DE_VIA becomes Tipo_De_Via. Unchecked by default. The names are changed afterwards one by one. |
| Metric “Number of …” | Creates the metric that counts the table's records (“Número de Facturas”, number of invoices; the name is formed with the table's alias). Checked by default: it is advisable for each fact table to have one. |
| Default access privilege | The access privilege of all its dimensions and metrics. By default, No level defined (anyone sees them). |
| Default edit privilege | The edit privilege of its dimensions in the forms. By default, Update dimension (generic). |
| Alias of … | The name users see. Up to 70 characters, without “.”, “[” or “]” (expressions cite tables as [Alias.COLUMN]) and different from that of the other fact tables of the connection. |
Each column of the table generates a dimension, with the type that corresponds to the column: Numeric for a number, Date for a date or a date and time, Text for the rest. Binary columns (images, documents) do not generate a dimension. Afterwards, delete the dimensions that are not needed, link the code ones with their auxiliary table and build the hierarchies.
The panel of a fact table#
When you choose a fact table in the tree, its panel states its physical name (“Fact table · COMERCIAL.FACTURAS”) and has these actions:
| Action | What it does |
|---|---|
| Who uses it? | The documents, lists and publications that use the table. See Usage and validation. |
| View in Presentation | Takes you to the Presentation tab with the table chosen. |
| Change the privileges of the whole table… | Sets a privilege on all its dimensions or its metrics in a single save. See Privileges and universes. |
| Delete… | Deletes the fact table from the metadata. |
Properties#
| Property | What it is |
|---|---|
| Alias | The name with which users see it. Changing it rewrites the expressions of the metrics that cite the table by its alias, and the impact shows it before saving. |
| Supports lists | Whether lists of its records can be saved (see Lists). It requires a primary key. A new table does not come with it checked. |
| Primary key | The columns that identify each record. Those of the database are proposed (“In the database: COD_CLIENTE.”). If the table has none, check them here: forms and lists need it. |
| Insert records | Who can create records of the table in the forms. |
| Modify records | Who can change any column of its records in the forms. |
| Delete records | Who can delete records in the forms. |
The three edit privileges come by default with the system's generic ones (Insert records (generic), Update records (generic) and Delete records (generic)). As long as no role has those privileges or the ones you set, nobody edits the table. Whoever can modify the table can change all its columns; in addition, the edit privilege of each dimension allows changing only that column (see Dimensions).
Fields#
One row for each column of the table, with its Type according to the catalog:
| Column | What it is |
|---|---|
| Description | The column header in the forms. |
| Next-value SQL | A statement the database recognizes that gives the column's value when a record is created, with a sequence or a function: this way the key of each record is unique even if several users create records at the same time. |
An example from the demonstration, in PostgreSQL, for the ID_INCIDENCIA column of the incidents:
If the key is an identity or autonumber column of the database, it is not needed: the database sets it on inserting, and ECenter collects it for the details created in the same submission.
Define the next-value SQL in all the tables, fact and auxiliary, whose records will be created from forms.
New columns in the database#
If the database table gains columns after it was registered, the metadata does not pick them up by itself. Click Refresh catalog (in View catalog or on the connections screen) and choose the table: at the top of its panel, a note says which database columns are not its fields.
- Leave With one dimension each, as when adding the table checked if you want one dimension for each column (except binary ones), named like the table's other dimensions and placed at the end of its folder in the presentation tree. Unchecked, only the fields are added, and the dimensions are created afterwards with New dimension….
- Click Add as fields. If you have unsaved changes in the table, save or discard them first.
Columns that are no longer in the database are not removed: the editor's consistency strip points them out.
The rest of the panel#
| Section | What it has |
|---|---|
| Indexes | The database indexes, for information only. They are created and changed in the database. |
| Dimensions | Its dimensions, with their type, and New dimension…. |
| Metrics | Its metrics in the order in which they are offered, with New metric…. They are reordered by dragging them or with Alt+↑ and Alt+↓; it is saved at once. |
| Value history | The table in which forms record how each record was and how it ended up (see Value history). |
| Relationships | Its relationships with other fact tables. Each one takes you to the Relationships tab. |
| Where it is used | The table's lineage (see Usage and validation). |
| Technical information | Identifier, table, EC7 code if it was imported and version. |
Value history#
Forms can keep a record of what they change: in a mirror table of the client database, in the same transaction as the change, they record how each record was before modifying or deleting it and how it ended up after creating or modifying it. It applies to all the forms of the table. If the recording fails, the change is not saved either.
The mirror table has:
- the columns of the data table you want to keep, with the same name and accepting nulls; at least those of the primary key;
- five columns of its own:
ECH_OPERATION(Iinsert,Uupdate,Ddelete),ECH_IMAGE(Bbefore,Aafter),ECH_AT(when, with the ECenter server's time),ECH_USER(the user who submitted it) andECH_SUBMISSION(the identifier of the submission, which brings together the rows of the same Submit changes).
What the user does not see because of column security is recorded empty.
- In the table's panel, in Value history, type the schema and the name of the mirror table.
- If it does not exist yet, click View the SQL: ECenter gives the statement to create it in the connection's engine, with the table's columns. ECenter does not run it: ask whoever administers the database for it.
- When it exists, refresh the connection's catalog and click Record the history here. If the table does not fit (it is missing, it lacks one of its own columns or a key column, or a column does not accept nulls), ECenter says so and does not save it.
Stop recording it removes the history; the mirror table stays as it is. To consult the history, register the mirror table as one more fact table, with its security.
The history does not travel in the metadata package: each environment declares its own.
User-defined tables#
A fact table created when integrating external data carries the User-defined mark and the note “A user defined it when integrating external data: it is edited here, but deleted from External data, with its data.”. Its dimensions, metrics and privileges can be changed like those of any other. See External data.
Delete a fact table#
- Choose the table and click Delete… (or Del in the tree).
- If something uses it, ECenter first shows what stops working (documents, lists, publications, alerts) and you click Delete anyway to continue; if something prevents it (a metric of another table that uses it in a formula, for example), you can only Close.
- If nothing uses it, confirm with Delete table.
Its dimensions, its metrics, its relationships and its place in the presentation tree are also deleted. The database table is not touched.