Relating Sites in a Submission
Introduction and Example Scenario
A form control can be configured to reference another site, organization or person. The reference can then be used to create a submission contact or a relationship to the selected site, organization or person when the form is submitted.
Well Driller Example
For example, a homeowner contracts with a licensed well driller to install a new water well at their residence. The agency regulating well drilling activities is responsible for licensing the well driller as well as recording the drilling of new wells.
To support this process, the agency wants to makes available an online form for the homeowner to select the well driller from a list of actively licensed well drillers. When the “New Water Well” form is submitted, the agency wants to record the well driller’s contact information on the submission as well as create a link between the well driller and the residence where the new well was installed.
The steps and data relationships are illustrated in the diagram below:
The numbered steps in the diagram are described below:
The agency establishes the ACME Well Drilling, Inc. well driller record as a site in nVIRO. The driller is assigned a unique well “Driller ID” of ABC123 as a Site Alternative Name.
The homeowner begins a “New Water Well Form” submission. This establishes the Smith Residence site.
The homeowner selects ABC123 - ACME Well Drilling, Inc. from a list of licensed well drillers on the “New Water Well Form” submission.
When the “New Water Well Form” form is submitted, the selected well driller information is copied as a contact on the submission.
In addition, a “Driller For” Site Relationship is created between Smith Residence and ACME Well Drilling Inc.,
This page illustrates the steps required to set up the “New Water Well Form” to operate similar to the example.
Configuring a Site Lookup as an Form Control Data Source
To make a set of sites available as an lookup list available to be assigned to an nFORM control, the sites must be assigned a Site Alternative Name. In the example above, ACME Well Drilling Inc. has been assigned a Site Alternative Name of type “Driller ID” with a value of “ABC123”.
To configure a Site Alternative Name as an nFORM control lookup, either create or update a row in dbo.REF_SITE_ALT_NAME_TYPE
and set IS_NFORM_LOOKUP = 1
.
Upon saving the row, a database trigger will create a new nFORM lookup with a name matching the CODE
value of the Site Alternative Name. The lookup will include all sites that have a Site Alternative Name assigned of the matching type. For the example above, the code value for the “Driller ID” Site Alternative Name is DRILLER_ID
.
Any time a “Driller ID” alternative name is added or removed to or from a site, it will immediately become available in the the nFORM lookup data source. Site Alternative Names can be added to a site via the Site Detail screen.
Configuring a Form Control as a Site Lookup
Once the Site Alternative Name lookup is configured using the steps outlined in the previous section, it can be added to a form short text control as the Auto-complete Data source.
Integrating Submission Site Lookup Data into nCORE
With some additional configuration, the Site Lookup selection in a submission’s form control can be used to create a contact in nCORE, create a site relationship in nCORE, or both. These are represented in steps 4 and 5 in the diagram at the top of this article.
The following sections describe how to configure a submission control’s site lookup selection to create a submission contact, site relationship, or both.
Create a Submission Contact from a Site Lookup Form Control
For the submission control’s selected lookup value to be created as a contact on the submission after it is submitted, set the control Tag to match an Affiliation Type Code or set the control label to a valid Affiliation Type Description. Affiliation Types are managed in the Lookups screen.
In the well driller example, an Affiliation Type with code DRILL
and description “Well Driller” could be created. The site lookup control’s Tag would therefore be set toDRILL
or the control’s label can be set to “Well Driller” to create the submission contact.
Create a Site Relationship from a Site Lookup Form Control
For the selected lookup to create a relationship between the submission site and the lookup’s Site, set the Tag of the short text control with a valid Site Relationship Type code, (e.g. DRILLER_ID
) followed by a >
or <
sign.
Site Relationship Types must be added directly to database table REF_SITE_RLNSHP_TYPE
.
Using the <
tag suffix will result in the submission’s site being the parent and the related site as a child in the relationship
Using the >
tag suffix will result in the submission’s site being the child and the related site being the parent in the relationship.
Setting Up a Site Lookup Form Control to Create a Submission Contact and a Site Relationship
It is possible to combine the techniques above to create a submission contact in addition to creating a site relationship. This can be achieved by setting the control tag to include both the Affiliation Type Code and the Site Relationship Type Code separated by a +
sign.
Continuing with the example above, the site lookup control’s tag could be set to DRILL+DRILLER_ID>
to create both a submission contact and a site relationship.
The integration as illustrated in the diagram at the top of this article is now complete.