The sub project point can be added to an existing project which will allow you to select another project to be linked as a sub project. This creates a relationship between the two projects where the existing project is the parent of the sub project. When creating a session in the parent project, the user can create new sessions for the sub project that will belong to the parent session. When a parent session is sent, duplicated or deleted this action will also apply to the parent’s child sessions and any child sessions of those sessions and so forth. This useful point enables you to build a form where a parent session can contain many sub sessions and can be configured to copy data from the parent session into new sub sessions. The sub projects can be chained together with more sub projects to create a structure of your own design, with as many levels of sub projects as desired.
Below is a diagram which demonstrates just some of the ways in which you can create a hierarchy of projects, using multiple sub project points. The diagram on the left shows the structure used in the sample projects that are used later in this tutorial to create the relationships between Buildings, Rooms and Assets.
The diagram on the right demonstrates a more advanced structure where a parent project, Sale, has multiple sub projects which also contain sub projects of their own.
The sub project point can be configured in the Mobile Data Anywhere Designer to customise the labels and buttons that are displayed in the mobile application as well as to configure points to be shared with new child sessions. Below is an example of the properties window for a Sub Project point, opened in the Mobile Data Anywhere Designer.
The client view options allow you to configure the language that is used to describe the relationship between the projects that are linked using a sub project point. These settings will be used in the mobile application to describe the child sessions in a more meaningful way.
Points to Copy Values Into Child Sessions allows you to select points from the parent project to copy their values into new child sessions. To ensure each value is copied into a new child session, the sub project will need to contain a point with the same ID as the point that is being copied.
In addition to copying values from custom points there are some additional values that can be shared with a child session. To copy these values into a child session you will need to ensure the sub project contains a point with the corresponding ID.
A point with the ID __parent_project__ will be populated with the project filename of the parent project.
A point with the ID __parent_guid__ will be populated with the parent session’s unique identifier (GUID).
The image below shows how an Edit Point has been configured to copy the parent_guid point from the parent session:
This sample simulates an asset auditing form which is used to collect information for assets that are assigned to rooms in a particular building. This sample contains three projects; Buildings, Rooms and Assets. The projects are linked together using sub project points so that a building can contain many rooms and each room can contain many assets.
These sample projects are setup using the structure outlined below where Buildings has a sub project called Rooms which in turn has a sub project called Assets.
This project is considered to be the parent project because it is the highest project in the hierarchy. This project contains a sub project point called Rooms which is used to link to a child project rooms.ppc. In the mobile application, this will enable the user to create many Room sessions that belong to a Building session. When a Building session is sent, deleted or duplicated this action will also be taken on all child sessions in the Room sub project, cascading down to any further sub projects as well.
The sub project point has been configured to copy the value of the Address point into child sessions. When a new Room session is created, the value of the Building’s Address point will be copied into the Room’s Address point. For more details see here.
The sub project point has been configured to customise the labels and buttons so that the text that is displayed on the mobile device is related to Rooms. See below for an example of the sub project point’s properties:
This project is referred to as the child project because it is the second project in the hierarchy. Any sessions created within this project will belong to a Building session, which is referred to as the parent session. Many sessions can be created that belong to the same parent session. In the context of the simulated building asset audit, this allows the user to collect data for many rooms in a particular building.
The Rooms project also contains a sub project point called Assets which is used to link to a child project assets.ppc. In the mobile application, this will enable the user to create many Asset sessions that belong to a Room session. This extends the existing parent-child relationship between Buildings and Rooms to create the parent-child-grandchild relationship seen in the diagram below:
The sub project point has been configured to copy the value of the Address point into child sessions. When a new Asset session is created, the value of the Room’s Address point will be copied into the Asset’s Address point. For more details see here.
The sub project point has been configured to customise the labels and buttons so that the text that is displayed on the mobile device is related to Assets. See below for an example of the sub project point’s properties:
This project is referred to as the grandchild project because it is the third project in the hierarchy. Each session that is created within this project will have a parent Room session. In the context of the simulated building asset audit, this allows the user to collect data for many assets that are located in a room, in a particular building.