Defining Loan Object

Note that when defining the Item object we did not define references to the Loan and Member objects. This is because we have not defined these objects yet, so they are not present in the list of attribute types. We need to define these objects first and then return to the Item object to define the missing references (in fact, we will be able to bypass this step by creating matching attributes – see below).

Let us define the Loan object. We define the DueDate, LoanDate, ReturnDate, RenewalCount and Status attributes first. All these attributes except the DueDate should be calculated automatically by the system and are, therefore, marked as calculated. The DueDate attribute will be in most cases calculated by the system, however, we want to let the operator manually change the calculated value as well. So we do not mark the DueDate as “calculated” attribute. We will set the initial value of the LoanDate attribute as CURRENT_DATE to make sure that when the Loan object is created the value of the LoanDate attribute is automatically set to the current date.

Next we will define the reference to the Item object. We specify the name for the new attribute Item and select Item from the list of attribute types (we have already defined the Item object so it is available in the list of attribute types). We leave the “Multiple allowed” checkbox un-ticked as the loan refers only to one item. We also select the “Create” radio button on the “Matching Data” dialog and enter “Loans” as the name of the matching attribute in the Item object.

Now we click on the “Save” button to create the Loan object. Note that we did not define the reference to the Member object because we have not defined the Member object yet.

We can now go back to the Item object and see that the Loans attribute has been automatically created in this object (to edit the existing object we right click on the object’s node in the Elements Tree and select “Edit” from the pop-up menu or just double click on the object). Let us have a look at this attribute. We select it in the attributes panel and look at its properties. We can see that the attribute was created with “Multiple allowed” checked – this is what we want in this case since the Item object can refer to multiple loans. If this wasn’t the case we could change the value of the “Multiple allowed” checkbox. We can also see that the matching attribute for the Loans attribute is Item (the attribute that we have just created in the Loan object).