![]() In this section, we will implement the relationships for orders data models. But before we can do that, we must understand the relationships that have to be created. How will the data be updated in "CustomerOrders" and "ProductOrders"?
As per our design, a form will be used to create an order. The form must provide the functionality to filter products by category, choose the product in required colour and size, and then enter the quantity. Also, it must allow multiple products to be ordered.
In traditional application development, to implement the above functionality, we have to write queries against category table to validate the product category or provide a list for category selection. Similarly, queries will have to be written against product tables to fetch/validate product description, product colour, size and price. Additionally, business rules will have to be written to determine the total amount based on the quantity, price and items ordered.
In OrangeScape paradigm, this will be achieved by establishing relationships between data models. Data models in OrangeScape are a "Network of objects". In a network, any object can be accessed from any level through these relationships. Hence, the links needed not be established during the run-time, as in the case with traditional development method. The business rules are built in the data models which are automatically executed by the rule engine.
Now, let's get started with establishing the required relationships for the orders data models.
![]() Connect as reference, but with criteria: "Product" and "ProductOrders" data models
The easiest way to achieve this is by creating a reference look-up for product description in ProductOrders data model. But if we were to do that, then we will have to somehow validate whether the product selected by the user belongs to the category selected by the user.
Is it possible to filter the product description data that is displayed in the list box when a reference look-up is created?
The "Connect" option provides two ways to achieve this.
![]() The list of available colours must be displayed for the product selected. To achieve this, reference look-up relationship, with criteria to filter colour based on product selected, must be established between "ProductColour" and "ProductOrders" data model. Follow the directions given below.
![]() The available sizes must be displayed for the product-colour combination selected. To achieve this, reference look-up relationship, with criteria to filter size based on product & colour selected, must be established between "ProductSize" and "ProductOrders" data model. Follow the directions given below.
|