--- alias: user-guide-generic-tables-index description: "Generic tables store data records with customizable views and properties" --- # Generic Tables **Generic Tables** are general purpose tables used to store data records. Each **Generic Table** has its own database table and will therefore require a unique metadata definition that can be done directly through the Critical Manufacturing Administration page. ## System Generic Tables The Critical Manufacturing installation is populated automatically with a set of **Generic Tables** which are necessary for the normal functioning of the system: {% include-markdown 'includes/docsync/generic_table_list.md' %} ## Generic Table Page Views ### Data View Lists all the data rows that are included in the **Generic Table**. You can add new rows or edit the existing ones. You can also export data to file. Additionally, you can use the :core-static-filter-lg: icon to filter the existing data. ![Data view of the Generic Table page](../../images/table_generic_data_view.png) ### Definition View * **Generic Table Definition** - displays information on the actual table definition. * **Properties** - list of the existing properties. ![Definition view of the Generic Table page](../../images/table_generic_definition_view.png) ### History View This view combines information concerning other objects that have references to the current **Generic Table** object: * **History** - displays the history of the operations, associated information, user(s) performing the changes and date and time of the changes. ## Creating a Generic Table :lock: GenericTable.**Create** ### Step 1: General Data 1. Enter a Name for the **Generic Table**. 2. Optionally, enter a Description. 3. Optionally, enter a Data Group. 4. Specify whether the table should keep the History information. 5. Optionally, enter the History Days by Default. 6. Optionally, enter a key to be used for reference in Localized Messages. 7. Select **Next** to define the **Generic Table** Properties. ![Screenshot showing a UI with a form field labeled "Create New Generic Table" and an input field with placeholder text "table generic create step one".](../../images/table_generic_create_step_one.png) ### Step 2: Properties 1. Add or remove as many properties as needed and you can also order them (use :material-plus: to add, :material-trash-can: to remove, and :material-arrow-up: or :material-arrow-down: to order properties). For each property, you need to enter: * Name. * Description. * Localized Message Key. * Key status (setting a field as **Key** forces the **Mandatory** status to be set as well). * Mandatory status. * Indexed in Database. * Reference Type (depending on the reference, additional details need to be provided below): * None * Entity Type * Entity Version - both the specific versionable Entity Type and the property it refers to are required. * Enum - specific enumeration needs to be specified. * Generic Table - both the specific Generic Table and the property it refers to are required. * Lookup Table * Lookup Value - Name of the table to use as a reference for the value. * Role * Smart Table - both the specific Smart Table and the property it refers to are required. * State Model * Data Type - depending on the reference type. * Size (applicable only to some data types - for example, VarChar, Decimal, among others). * Decimal places, applicable only to Decimal data type. Must be less or equal to the Size. * Validation range (optional) - a string like '[start,end]' to designate ranges between start and end. An open bracket at the end excludes the limit values, for example, [1,10] excludes the number 1 and includes the number 10. * Validation regular expression (optional). * Default value (optional). 2. Select **Create** to complete the operation. ![Screenshot showing a UI with options for creating a new entity named "Create New Geno".](../../images/table_generic_create_step_two.png) !!! warning In SQL Server, there is a 900-byte limit for the maximum total size of all index key columns. Decimal range validations must use the current cultured defined decimal separator. ### Step 3: Generating Schema :lock: GenericTable.**GenerateSchema** Steps 1 and 2 are used to create the table definition. To create the schema in the database and to be able to use it anywhere in the system, the **Generic Table** must be actually created and made active by inserting it into the database. ![Screenshot showing a database schema creation process in Step 3.](../../images/table_generic_create_step_three.png) This schema generation is achieved by selecting the **Generate Schema** button from the **Generic Table** **Definition View**. ![Screenshot showing a database schema creation process.](../../images/table_generic_create_step_four.png) !!! info To generate the schema, the table must have at least one key defined. ## Editing a Generic Table Definition :lock: GenericTable.**Edit** To edit the definition of the **Generic Table**, open the **Definition View** and select the :material-pencil: button. A wizard will be displayed to allow editing the basic details as well as adding or removing properties. Selecting **Save** will save the new settings. !!! warning The steps above are used only to modify the table definition. To apply the changes, it is necessary to select the Generate Schema button. ## Terminating a Generic Table :lock: GenericTable.**Delete** To terminate a **Generic Table**, it is necessary to open the **Generic Table** details and select the **Terminate** button. !!! warning A Generic Table cannot be terminated if referenced by an active object. ## Editing Generic Tables Data :lock: GenericTable.**EditData** To edit a **Generic Table** data, proceed as follows: 1. Open the **Data View**. 2. Add new records by selecting :material-plus: on the top ribbon. 3. Selecting the :material-pencil: button will open a dialog that allows the user to edit existing records. 4. Remove existing records by selecting the values and selecting the **Remove** button on the top ribbon. 5. Select **Save** to commit the changes. !!! info To edit the Generic Table values, the table must have been generated. ## Copy Generic Tables Data :lock: GenericTable.**EditData** To copy a **Generic Table** data, proceed as follows: 1. Open the **Data View**. 2. Select one or more records from the table. 3. Select **Copy** on the top ribbon. ![Screenshot showing a table with data and a "Copy" button in the top ribbon.](../../images/table_generic_copy_one.png) 4. In the wizard, select the record you want to copy. 5. Select the copy icon at the top of the grid. 6. For each copied record, make the changes you need. 7. Select **Copy** to complete the operation. ![Screenshot showing a generic table with data being copied.](../../images/table_generic_copy_two.png) It is also possible to copy records by using the **Add** operation on the top ribbon. ![Screenshot showing a generic table with data, illustrating the step for copying records.](../../images/table_generic_copy_add.png)