40
Views
4
Comments
Data Model Integrity

What is data model integrity? can any one explain with example 

2020-07-21 19-28-50
Rajat Agrawal
Champion

Hi @Neelish immidi,

Have checked this outsystem training session it will help you more please check:

https://learn.outsystems.com/training/journeys/data-model-integrity-638

Hope this will help you!!

Regards,

Rajat

2019-11-11 17-10-24
Manish Jawla
 
MVP

Hi @Neelish immidi ,

Please check the below documentation for reference.

https://success.outsystems.com/documentation/11/building_apps/data_management/data_modeling/entity_relationships/ 

I would advise you to go through the Training path for web developer, that will resolve most of your query.

https://learn.outsystems.com/training/journeys/intro-to-outsystems-development-2712/web-developer-662 

Regards,

Manish Jawla

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi Neelish,

Do you awe a pattern in your questions and the replies you get?

  1. You ask a very generic question
  2. People search thr relevant training & documentation for you and share it in a replying.

As said before, it would be very benificial if you follow free available training, or search thr topic you wanf to know about in the documentation.

Regards,

Daniel

2024-09-17 12-24-07
Rammurthy Naidu Boddu
Champion
AI Generated

Data Model Integrity refers to ensuring that the data in a system remains accurate, consistent, and valid throughout its lifecycle. In OutSystems, as in other systems, this involves maintaining the consistency of relationships between different entities and ensuring that data constraints are followed to prevent corruption or invalid data from being stored in the database.

Types of Data Integrity in OutSystems

  1. Entity Integrity:

    • Ensures that each record in a table (Entity) is unique and identifiable.
    • Example: In OutSystems, each Entity has a primary key (usually an Id) that uniquely identifies each record. You must ensure that this Id is not null or duplicated.
  2. Referential Integrity:

    • Ensures that relationships between tables (Entities) remain consistent. If one entity refers to another, the referred entity must exist.
    • Example: If you have two entities, Order and Customer, and an Order references a Customer, you must ensure that any Order is always linked to a valid Customer. OutSystems handles this automatically with Foreign Keys.
    • Scenario: If Order.CustomerId refers to a Customer, you cannot delete the customer without first handling their associated orders. OutSystems will enforce this by preventing deletion unless the relationship is updated (e.g., set CustomerId to null or cascade delete orders).

  3. Domain Integrity:

    • Ensures that the data entered in fields meets the predefined constraints, such as valid data types, ranges, or formats.
    • Example: In OutSystems, you can define data types and validation rules (e.g., a BirthDate field must be a valid date, or an Email field must be formatted correctly). You can set constraints on attributes such as:
      • Not Null: A field cannot be empty.
      • Range Validation: A numeric value must fall within a certain range.
  4. Business Rule Integrity:

    • Ensures that the data adheres to specific business logic rules that have been defined for the application.
    • Example: You might want to ensure that an order cannot be placed if the total amount is less than a certain value or that an employee cannot be assigned more than a specific number of tasks. OutSystems allows you to define business logic using server actions or process flows to enforce these rules.

Example of Data Model Integrity in OutSystems:

Consider a simple Student Enrollment System with two entities: Student and Course.

  • Entities:

    1. Student (with fields like Id, Name, Email)
    2. Course (with fields like Id, CourseName, Capacity)
  • Relationships:

    • A Student can enroll in multiple Courses (many-to-many relationship), which is handled through a Join Table (Enrollment entity).
    • Entities:

    • Enrollment has the fields StudentId and CourseId (foreign keys to Student and Course).

Ensuring Data Integrity:

  1. Entity Integrity:

    • Each student has a unique Id, and each course has a unique Id. No duplicate or null values can exist in these primary key fields.
  2. Referential Integrity:

    • If you attempt to delete a Course, the system should ensure that no students are currently enrolled in that course, or if they are, they should either be unenrolled first or the deletion should cascade to the Enrollment records.
    • Example in OutSystems: If a course (CourseId) is deleted, the related Enrollment records will be affected. OutSystems will enforce this by giving an error if you attempt to delete a course that is still being referenced, unless you have set up cascading delete behavior.

  3. Domain Integrity:

    • If the course Capacity is defined as an integer, OutSystems will not allow values like text (abc) or negative numbers to be entered. You can further ensure that capacity must be greater than zero.
  4. Business Rule Integrity:

    • You could enforce a business rule that no student can enroll in more than 5 courses at a time. You would handle this in the logic when creating a new enrollment, and check if the student is already enrolled in 5 courses before allowing them to enroll in another.

Example of Integrity Violation:

  1. Entity Integrity Violation: If somehow two Students have the same Id, this would violate entity integrity. OutSystems prevents this by enforcing unique primary keys.
  2. Referential Integrity Violation: If an Enrollment record references a Course that has been deleted, this breaks referential integrity. OutSystems prevents this by enforcing referential constraints.
  3. Domain Integrity Violation: If a Student's Email field is left blank, despite being marked as "not nullable," this would be a domain integrity issue. OutSystems' data validation prevents this from happening.
  4. Business Rule Integrity Violation: If a business rule says that a Course can have a maximum of 30 students, and more than 30 enroll, that violates business rule integrity. This can be controlled in the logic layer in OutSystems.

How to Ensure Data Model Integrity in OutSystems:

  1. Entity Relationships:

    • Use foreign keys to establish relationships between entities (like CustomerId in Order). OutSystems automatically enforces referential integrity.
  2. Validations:

    • Define validation rules on inputs to ensure data meets domain integrity (e.g., check if Email is correctly formatted).
  3. Business Logic:

    • Implement business rules in the logic layer (server actions, screen actions) to ensure that rules like limits on enrollment or constraints on record deletion are followed.
This answer was AI-generated. Please read it carefully and use the forums for clarifications
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.