Opadeez Help Center

Your First Application - Part 3

Creating the Data Model

In Part 2, we created a menu system with security access. Now we'll create a simple data model for our customers and projects, including relationships and business rules.

What We'll Build: A complete data model with Customer and Project entities, including calculated fields, value lists, relationships, and dynamic attribute rules.

Step 1: Create the Customer Entity

Let's start by creating our first entity to store customer information:

  1. Navigate to Data Dictionary → Entities / Attributes
  2. Click "New Entity"
  3. Set Entity name: Customer
  4. Save the entity

Step 2: Add Customer Attributes

Now we'll add attributes to the Customer entity. Make sure the Customer entity is selected:

Company Name Attribute

  1. Click "New Attribute"
  2. Configure the attribute:
    • Attribute name: CompanyName (no spaces)
    • Label: Company name (can have spaces)
    • Type: String
    • Length: 50

Relationship Date Attribute

  1. Click "New Attribute" again
  2. Configure the attribute:
    • Attribute name: RelationshipDate
    • Label: Relationship date
    • Type: Date

Calculated Relationship Duration Attribute

Let's create a field that automatically calculates the relationship duration in years:

  1. Click "New Attribute"
  2. Configure the attribute:
    • Attribute name: RelationshipDuration
    • Label: Relationship years
    • Type: Integer
    • Length: 4
    • Formula: dateDiff(RelationshipDate, now(), "y")
Formula Tip: Use the gear icon in the Formula text area to open the script helper for assistance with syntax and available functions. See the Opadeez Scripting Language Reference for complete documentation.
Relationship Duration Formula Configuration

Formula configuration for auto-calculating relationship duration in years

This formula will dynamically calculate the relationship duration whenever the field is displayed or used in a calculation.

Step 3: Create the Project Entity

  1. Click "New Entity"
  2. Set Entity name: Project
  3. Save the entity

Step 4: Add Project Attributes

With the Project entity selected, create the following attributes:

Project Name Attribute

  1. Click "New Attribute"
  2. Configure:
    • Attribute name: Name
    • Label: Project Name
    • Type: String
    • Length: 50

Project Status Attribute

  1. Click "New Attribute"
  2. Configure:
    • Attribute name: Status
    • Label: Status
    • Type: String
    • Length: 1

Step 5: Create Value List for Project Status

To make the Status field display as a dropdown list, we'll create a value list:

  1. Navigate to Data Dictionary → Value Lists
  2. Click "New Value List"
  3. Set Value List name: ProjectStatus

Add Status Options

  1. Click "New option" and configure:
    • Value: P
    • Text: Pre-sales
  2. Click "New option" again for:
    • Value: I
    • Text: In-progress
  3. Click "New option" once more for:
    • Value: C
    • Text: Complete
Project Status Value List Configuration

ProjectStatus value list with Pre-sales, In-progress, and Complete options

  1. Click "Save all" to save the value list

Step 6: Associate Value List with Status Attribute

  1. Go back to Data Dictionary → Entities / Attributes
  2. Select the Project entity
  3. Select the Status attribute
  4. In the Value List dropdown, select ProjectStatus
Note: The value list must be saved using "Save all" before it appears in the dropdown list.

Step 7: Create Relationship Between Entities

Now we'll create a relationship saying that a Customer can have multiple projects:

  1. Navigate to Data Dictionary → Links
  2. Click "New Link"
  3. Configure the relationship:
    • Link name: CustomerProject
    • Entity from: Customer
    • Entity to: Project
    • Cardinality: 0 (0 means unlimited)
Customer Project Link Configuration

Link configuration showing one-to-many relationship between Customer and Project

  1. Save the link

Step 8: Understanding DataSets

We've created the database structure with Entities, Attributes, and Links. Now we need to create a "DataSet" - a specific view of the data.

DataSet Purpose: Opadeez allows you to reuse the same data for different purposes. DataSets create tree views of your data, making it easily accessible and navigable for users. They can also have specific rules for mandatory fields, read-only attributes, and visibility conditions.

Examples of different DataSet approaches:

Step 9: Create Customer DataSet

  1. Navigate to Data Dictionary → Data Set
  2. Click "New Data set"
  3. Set DataSet name: Customer

Add Customer Entity to DataSet

  1. Click "Add entity to Data set"
  2. Configure:
    • Alias: Customer
    • Entity name: Customer
  3. Save this entity

Add Project Entity to DataSet

  1. Click "Add entity to Data set" again
  2. Configure:
    • Alias: Project
    • Entity name: Project
    • Link from entity: Customer (save the previous entity first to see it in the list)
    • Link name: CustomerProject
Customer DataSet Configuration

Customer DataSet showing the hierarchical relationship between Customer and Project entities

  1. Save your changes

Step 10: Configure Dynamic Attribute Rules

Let's demonstrate Opadeez's dynamic attribute rules by making the RelationshipDuration field conditionally visible:

  1. Make sure the "Customer" DataSet Entity is selected
  2. Click "Modify attribute rules" to open the DataSet Attributes page
  3. Click "Add Attribute definition"
  4. Configure the rule:
    • Attribute name: RelationshipDuration
    • Visibility rule: Customer.RelationshipDate <> ""
Script Helper: Click the gear icon to open the script helper for assistance with formula syntax. For complete syntax documentation, see the Opadeez Scripting Language Reference.
Relationship Duration Visibility Rules

Dynamic attribute rule making RelationshipDuration visible only when RelationshipDate has a value

This rule ensures that the RelationshipDuration field is only visible when the customer has a relationship date entered.

Congratulations! You've created a complete data model with:
  • Two entities (Customer and Project)
  • Calculated fields with formulas
  • Value lists for dropdown selections
  • Entity relationships
  • DataSets for data navigation
  • Dynamic attribute rules

What's Next?

This completes Part 3 of the tutorial. Continue with:

Key Concepts Learned

Pro Tip: Always design your data model carefully before building the UI. A well-structured data model makes creating flows and pages much easier.