Skip to main content
Entity Fields

Learn about InsightBase Entity Fields - the different types of fields, how to create and configure them.

Dan avatar
Written by Dan
Updated over a week ago

An Entity Field is one single field that stores one piece of information. In the case of a "user" table, you can have fields like "name", "email", "phone", etc.

To create new fields, go to your Entity page, "Fields" tab, and press the "+ Add Field" button.

1. Field Types

There are four different field types that serve different purposes:

  1. Column fields - they simply represent a column in your database table. There is nothing special about them.

  2. Foreign key fields - they represent keys to other Entities in InsightBase. Please note that they represent keys to other Entities, not database tables. If you want to create a relationship between two tables in your data source, you will have to create one entity for each of your database tables that you want to relate.

  3. Related entity field - this is a field from a foreign entity - it is like using the "join" operation in SQL, and that field will become a property of the entity. You can use it to "copy" some important information from your related entity, that might be relevant to the original Entity.

  4. Computed field - these fields are computed based on your table fields. For instance, if your "order" table has a "price" and "quantity" field, you can create an "amount" field by creating a computed field, that multiplies the "price" by the "quantity".

1.1. Common Field Properties

The Fields have a few common properties that are shared by all the fields:

  1. Type - the type of the field (Column, Foreign Key, Related Field, Computed).

  2. Field Name - the name of the field (keep the same format as the database - lowercase letters, alphanumeric). It is the name that will be used to reference this field in the code.

  3. Display Name - a name that will be shown to the users on the analytics page, and everywhere else. It should be user-friendly and easy to understand.

Here are more details about each field in part:

1.2. Column Fields

A column field is mapped to one of the table fields. As said before, a column field doesn't have anything special, they simply represent information that you would like your colleagues to see.

In addition to the common properties, the column field has the following properties:

  1. Column - the table column that you want to associate with this field

1.3. Foreign Key Fields

A foreign key field represents a relation to a different Entity. Here's what you can do once you create a foreign key, and thus associate an Entity with a different Entity (for the sake of this example, imagine that we associate a "customer" entity with an "order" Entity).

  1. You will see the associated Entity data - for instance, you can see the customer data in your order details.

  2. You will be able to filter the data by the associated entity fields. For instance, filter orders based on customer country.

  3. You will be able to segment the data based on related entities

Here are the properties that you'll have to fill in when creating Foreign Key Fields, in addition to the column properties:

  1. Entity - the entity that you want to associate the current Entity with.

  2. Entity Field - the field on the related entity that represents the foreign key field. For instance: "customer_id".

  3. Local Field - the local field that represents the reference to the foreign entity.

1.4. Related Entity Fields

A related entity field will behave the same way as a column field, with the exception that it's a field from a different entity. It's just a different way to perform specific analyses based on the related entity.

Here are the properties that you'll have to fill in when creating Related Key Fields, in addition to the column properties:

  1. Entity - the entity that you want to associate the current Entity with.

  2. Entity Field - the field on the related entity that represents the foreign key field. For instance: "customer_id".

1.5. Computed Fields

A computed field is a "dynamic" field - it doesn't really exist in your table, and it's a field that gets generated based on other fields.

For instance, a "order" table might have an "amount" computed field, that multiplies the "price" and "quantity" fields.

Once configured, the computed fields would behave as if they were real columns in your database, and you will be able to perform the same operations on them:

  1. Filtering

  2. Grouping

  3. Calculating totals

Here are the Computed Field Properties:

  1. Operation - the operation used to calculate the field

  2. Fields - the fields that will be used for this operation

For instance, to create an "amount" field that multiplies the "quantity" by the "price", you would select "Multiply" as the operation, and select both "quantity" and "price" fields in the "Fields" input:

2. Field Options

There is a common set of options that are available to all the Field types. They are usually used to control how the field behaves in the InsightFlow .

  1. Show in table view - select whether you want users to see this field in the table view. You might have "hidden" fields that you use to define your query, or to create relationships, but you don't want users to see them on the table views. Or maybe you want to keep the table views clean, but instead allow more fields in the filters section. For instance, in this case, there are four fields visible in the table view:

  2. Use in Segmentation - this will control whether this field should be used to group the data. You should enable this for the fields that usually represent various segments in your data, like countries, order types, etc.

  3. Use in Metrics - whether to use this user in various metrics. For instance, you might want to enable this for a "amount" field, so that you can calculate various metrics for the amount field.

  4. Use in Filters - select whether this field should show up in filters, and whether you want the users to be able to filter the data by this specific field.

3. Field Formatting

Formatting allows you to choose how the Field value will be shown everywhere throughout your project.

At the moment, there are two formatting options:

  1. Currency - it will display your field value as a currency number, with the currency prefix, for instance: "$1,446.00".

  2. Date - it will display your field value as a nicely formatted date, according to the format you select, for instance, "April 23, 2024".

4. Field Mapping

Field mapping is a way to provide more information about specific your Entity, that's going to be used in different places, like InsightFlow.

Here are the list of available fields that you can map:

  1. ID Field - this is going to be used to uniquely identify the Entities in your data. Usually, it's going to be an ID field from your database, but it could also be something unique, like the user email.

  2. Date Created Field - this is one of the most important things, and we highly recommend you set this field. It is used in most of the available analytics in the InsightFlow. Usually, there's a field that you use to store the creation date of your database entries, and that's the field that you have to set it as the Date Created Field.

  3. Title Field - this field represents how your Entity shows up in foreign key fields, in filters, or when filtering by a foreign field value. For instance, for a "customer" table, you can select the "name" or "email" as the Title Field.

  4. Country Field - this represents the country that your Entity entries are considered for. It is optional, but it's required if you want to analyze your data based on specific countries and create geographical charts.

Did this answer your question?