This topic explains how to use the Specification Host control, including information on:
This article discusses how to use the Specification Host control.
Dialog Forms, launched from Item Lists, Dialog or Macro Buttons in the hosted specification, are not supported inside of a Specification Host Control.
The Specification Host control requires the following:
![]()
The Specification Host Control is added to the host project.
On the form required to display the hosted specification, add the Specification Host Control.
Set the Width and Height properties to be the same as the form that will be displayed for the hosted specification.
Decide when the hosted specification should be initialized:
To run the hosted specification automatically:
To run the hosted specification manually:
The following methods for running a hosted specification are available:
Targets the Specification Host control to create a new specification from the project specified in the Project Name property
Targets the Specification Host control to run the Transition Name on an existing specification based on a Specification Name or Specification ID.
When using the Specification Host control to host child specifications the set up will look like the following:
![]()
When the child specification transitions from the Specification Host control it is added to the child specification list.
A parent - child relationship is maintained between the host and the hosted specification.
Hosting child specifications only supports a single level (parent - child) relationship.
Parent - child - grandchild relationships are not supported.
When setting up the Set Specification Host task for hosting child specifications the following methods are available:
Targets the Specification Host control and a Child Specification List in the host, to create a new child specification from the project specified in the Project Name property.
Targets the Specification Host control and a Child Specification List in the host, to run the Transition Name that edits an existing child specification based on the Specification Name or Specification ID property.
The Child Specification List control allows data to be passed between parent and child using constants, variables and specification properties.
These are supported when hosting a child specification in addition to the methods for passing data between a host and hosted specification outlined in the following section.
However care must be taken that no conflicts between constants and specification properties occur between the two methods.
When a new or existing child specification is hosted, data can be passed between the host and the hosted specification by using constants and variables applied in the Child Specification List editor launched from the Projects property of the child specification list control.
When a new or existing DriveWorks specification is hosted, data can be passed between the host and the hosted specification by using the following:
See Passing Data to the Hosted Specification below.
These are returned as an array to the Return value of the specification host control.
See Passing Data from the Hosted Specification below.
The set up of the Specification Host control for passing data is described as follows:
![]()
Data can be passed to the hosted specification through the Input Values property on the Specification Host Control (available from the Behavior category for the control properties).
These values will be continuously synchronized between the host specification and the hosted specification.
The data is passed to the Input Values property as a two column table with the headers "Name" and "Value".
Each subsequent row in the table represents the name of a Constant or Control and a value to be passed to the hosted specification.
For example:
The following DriveWorks table (Group Table, Simple Table, Calculation Table) can be referenced by the Input Values property:
| Name | Value |
|---|---|
| Height | 200 |
| Color | Blue |
Or the table can be written as an array directly on the Input Values property:
{"Name","Value";"Height","200";"Color","Blue"}
Either method will pass the value "200" into a constant or control named "Height" and the value "Blue" into a constant or control named "Color".
The control with the same name will not have the value passed into it.
Ensure the value being passed matches the expected value of the control.
For example:
An array (either written in its raw form or through a table) cannot be passed to a hosted specification directly from the Value column of the Input Values array.
For example, the array:
{"Make","Model","Color";"Volkswagen","Golf","Blue";"Ford","Escort","Red"}
Will not pass into any constant or control in the hosted specification.
To overcome this the array or table data must be converted to one of the following formats:
Use the function CSVFromTable and TableFromCSV to convert between these formats.
Use the Specification PowerPack function SppConvertTableToJson and SppConvertJsonToTable to convert between these formats.
Use the Specification PowerPack function SppConvertTableToXml and SppConvertXmlToTable to convert between these formats.
For example:
CsvFromTable({"Make","Model","Color";"Volkswagen","Golf","Blue";"Ford","Escort","Red"})
The return value from the Specification Host Control is an array of data that contains the the following information about the hosted specification.
For example, the following array is returned to the host specification:
{"Specification Id","Specification Name","State Name";40,"Hosted 0040","Specify"}
Additional information can be passed to the Return value of the Specification Host control by creating and applying rules to Specification Properties in the project of the hosted specification.
For example, the following specification properties and rules are applied in the hosted specification:
| Specification Property | Rule |
|---|---|
| Length | LengthReturn |
| Color | DWConstantColor |
The array returned to the return value of the Specification Host control in the host specification will be:
{"Specification Id","Specification Name","State Name","Length","Color";40,"Hosted 0040","Specify",200,"Blue"}
It is possible to trigger a macro to be run in the hosted or host specification, by using the following methods:
Use the Run Macro in Hosted Specification task.
Use the Run Macro in Host Specification task.
These tasks allow interactions between the host and hosted Specifications.
These macros can also be used to pass values between the host and hosted Specifications.
By using the Macro Argument property a value will be passed to the special variable DWCurrentMacroArgument in the hosted or host specification.
The following Tech tips available from my.driveworks.co.uk (login required) show the Specification Host control in action:
| Knowledge Base Article Ref: | KB16122101 |
|---|