A new object can be created using the syntax
As an example, suppose we have an object type "person" with an attribute "name".
We would define a variable for the object, and initialise it as follows:
Setting dates and times
Date type. To set a date or datetime to the
current date/time, use
new Date(). To set it to a specific date, use
new Date(year, month, day). For more details,
see this article at Mozilla.
An object can be deleted using its
As an example, suppose we have an object type "person":
Unlike attributes, a relationship is set using a setter function.
As an example, suppose that in our Data Model every person is part of a household:
In our view we define our household and person:
As you can see, we set the "household" relationship on the "member" by calling the
household() function and passing the related "household" object as an argument.
As a more typical example, the household will be created in another view and passed as a parameter:
Getting a related object works that a particular object belongs to is done by calling a getter function, as seen below: