How To: Apply Line Item Numbers To Child Specifications
Please note that while this method of applying line numbers would still work, the addition of the new Special Variable Specification Parent Row Index makes this method obsolete.
Specification Parent Row IndexName: DWParentRowIndex
To accompany the new embedded specifications functionality a new
Special Variable, called Specification Parent Row Index
(DWParentRowIndex) has been added.
This special variable reflects the position of each child
specification in the parent specification's child specification
control, and enables that position to be used in the child
specification. The index will be automatically updated in each
child specification when a child specification is added, deleted,
copied, moved up and moved down.
Examples
Rule | Meaning |
---|
DWParentRowIndex | Will return 1 if the child specification is at the top of the
list in the child specification list control. Will return 3 if the child specification is third in the
list in the child specification list control. |
The child specification list allows multiple projects to be
specified into a parent project. This article discusses how to
apply a line item number to each project specified through the
child specification list.
This article outlines the steps required to implement line item
numbering to a child specification list that will conform to the
following:
- The item number is applied consecutively, to each
specification in the order they are added to the child
specification list.
- The item number allocated will remain with the child
project when its ordering in the child specification list is
changed and when the child project is edited.
- Deleting a specification from the child specification
list will also remove the item number from being used in subsequent
child specifications, unless the last item is deleted.
How it Works
During the running of a specification the Line Item Number is
calculated in the Parent Project. This is then passed down to a
constant in the Child Project, where a Specification Flow
task (which is run when a New specification is created
only) drives this value into another constant to fix it for
the life of the child specification. The value of this constant is
then passed back up into the top level specification.
How To Implement
A project that utilizes the child specification list control to
specify a child project must exist to implement the following
steps. See
How To: Specify
Multiple Projects Into One Main Project using the Child
Specification List control for information on how
to apply the child specification list.
The steps to implement Line Item Numbering are split into the
projects that require functionality incorporating to make this
work. The first step is to add the functionality to all the child
projects that can be specified from the child specification list
control in the top level project. The second step is to add
functionality to the top level project and the child specification
list control in this project.
Step 1. Add the functionality to the Child Project
Open the group in DriveWorks Administrator and then open the
project that will be specified from the child specification list
(the child project).
Create the Constants
One constant will receive
the next item number from the parent project, and the other will
hold the fixed item number so that it will not change if the child
specification is edited.
Select Define Constants from the
task explorer. Click Add to add a constant, enter the name
NextItemNumber. This will hold the next line
item number being passed down from the top level project.
Click Add to add another constant,
enter the name
FixItemNumber. This is where the NextItemNumber
constant will be fixed by the task in the specification flow.
Create the Variable
This result of this
variable will be sent up to the child specification list
control in the parent project.
Select Define Variables from the
task explorer. Click Add to add a variable, enter the name
ItemNumber. This will be used to send the
FixItemNumber constant value back up into the child specification
list once a child specification has been added.
Select the variable and click Build
to launch the rule builder.
Select the Constants tab of the rule
builder and double click the constant FixItemNumber.
DWConstantFixItemNumber will appear in the rule window.
Click Ok to apply the rule.
Edit the Specification Flow
Including a Drive Constant
task on the New Specification event, in the specification flow,
will fix the item number in place.
Select Specification Flow from the
task explorer.
If the default specification flow is
in use click the Customize Specification button.
Select Edit on the Specify
state.
Select Enter State from the State
Items.
From the Toolbox, select the task
Drive Constant Value and...
Drag it to the Task Sequence for
'Enter State' area
With the Drive Constant Value task
still selected in the Task Sequence area select the Constant Name
property in the properties area. Double Click the grey orb, next to
the Constant Name property, so it turns green. This now allows a
rule to be built on the property, click the button to launch the
rule builder.
Enter the name of the constant to
drive a value in,
"FixItemNumber". Click OK to apply the rule and
close the rule builder.
Double Click the grey orb, next to
the Constant Value property, so it turns green. Click the button to
launch the rule builder.
Select the constants tab in the rule
builder and select the constant
NextItemNumber. Click OK to apply the rule and
close the rule builder.
- Save the project and open the parent project to edit.
Step 2. Add the functionality to the Parent
Project
Add the Item Number column to the child specification list
control
The child specification list control requires a column
to display the Item Number for the child specification. This is
required to be in place before we can refer to it in the rules for
the variables that are create next.
Select Form Design from the task explorer. Select the form
that has the child specification list control and then select the
child specification list control from the form.
Select the Projects property for the child specification list
and click the button to launch the Child Specification List
editor.
Select the Result Columns tab and enter Item Number in the Add
Column field, Click Add.
Click OK to close the editor.
Create the Variables
Two variables are required. One variable will count
how many child specifications have been added. And the other
variable will determine the last item number in use, just in case
any child specifications have been deleted. These variables will
then be compared in the child specification list control to
determine which is the item number to send down to the next child
specification.
Select Define Variables from the task explorer. Click Add to
add a variable, enter the name
CountChildSpecs. This will be used to count how
many child specs have been added.
Click Build to launch the rule builder to create the rule for
this variable. click the Functions button and type DCOUNT in the
filter list. Select the DCOUNT function and click OK.
In the wizard for the DCOUNT function select the name of the
Child Specification List control from the Table field.
In the Column field select the Name column
In the Condition field enter
"<>""". This evaluates to does not equal
blank. Click finish in the wizard and OK in the rule builder to
apply the rule. The rule should look like the example below; where
DWSubResultsChildSpecList1 is the name of the child specification
list control.
DriveWorks
will display the result of this rule as 1. This is because the
DCOUNT function counts the header row of the child specification
list control. This will be considered when we apply the other
rules.
DCOUNT(DWSubResultsChildSpecList1,3,"<>""")
Click Add to add another variable, enter the name
LastNumberUsed. This will determine the last
number used.
Click Build to launch the rule builder to create the rule for
this variable. click the Functions button and type GETTABLEVALUE in
the filter list. Select the GETTABLEVALUE function and click
OK.
In the wizard for the GETTABLEVALUE function select the name
of the Child Specification List control from the Table field.
In the Row Index field select the variable
CountChildSpecs
In the Column Index field select the Item Number column. Click
finish in the wizard and OK in the rule builder to apply the rule.
The rule should look like the example below; where
DWSubResultsChildSpecList1 is the name of the child specification
list control.
GetTableValue(DWSubResultsChildSpecList1,DWVariableCountChildSpecs,3)
- This rule also needs to consider that when
DWVariableCountChildSpecs equals 1 the result will be the header
name of the column and not an Item Number. To do this we will use
the IF function, but first
cut the GETTABLEVALUE function created above to
the clipboard, as this will be used in the wizard for the IF
function. Click the Functions drop down list and select IF from the
list of common functions.
- In the If field paste the GETTABLEVALUE and at the end of this
function type ="Item Number"
- In the Then field enter zero 0
- In the Otherwise filed paste the GETTABLEVALUE function again.
Click Finish to close the wizard and OK to apply the rule. The rule
should look like the example below; where
DWSubResultsChildSpecList1 is the name of the child specification
list control.
IF(GetTableValue(DWSubResultsChildSpecList1,DWVariableCountChildSpecs,3)="Item Number",0,GetTableValue(DWSubResultsChildSpecList1,DWVariableCountChildSpecs,3))
Edit the Child Specification List control
The information to send down to each child
specification and the information to retrieve from each child
specification can now be added to the child specification list
control.
Select Form Design from the task explorer. Select the form
that has the child specification list control and then select the
child specification list control from the form.
Select the Projects property for the child specification list
and click the button to launch the Child Specification List
editor.
From the Project Details tab select the project name for the
child specification that can be added from this control. Click the
link "The information for the selected child project may be out of
date if it has been changed. click here to refresh it." The
constants added above will be shown in the list. Select the
constant
NextItemNumber and click Build Rule, to launch the
rule builder.
The result to pass down to this constant will consider if any
child specs have been deleted from the child specification list by
comparing the quantity of child specifications that have been added
with the last item number that appears in the list. To do this the
IF function is used. Click the Functions drop down list and select
IF from the list of common functions.
- Select the If field and then select the variable
CountChildSpecs from the variables tab. Type <= (less than or
equal to) and then select the variable LastItemNumberUsed
- Select the Then field and then select the variable
LastItemNumberUsed, Type +1
- Select the Otherwise filed and then select the variable
CountChildSpecs. Click Finish to close the wizard and then OK to
apply the rule. The rule will look like the example below;
IF(DWVariableCountChildSpecs<=DWVariableLastItemNumberUsed,DWVariableLastItemNumberUsed+1,DWVariableCountChildSpecs)
- Click the Result Column Variables tab of the Child
Specification List Editor. With the name of the child project
selected in the projects list, select Item Number from the results
column. Double click in the variable name cell for this result
column and select ItemNumber from the drop down list. This is the
variable in the child project that has the FixItemNumber constant,
driven by the task in the specification flow, applied to send back
up to the parent project.
Click OK to close the editor.
Save the project.
The parent project can now be specified to see this feature
working.
Knowledge Base Article Ref: | KB13120301 |
---|
A project where the child specification list control has been
added to one of the user forms and from which the child project or
projects can be specified.
A project that is specified by clicking Add from the child
specification list control in the parent project.
Specification Flow is a powerful feature that gives you full
control over the specification process. Specification flow can
be tailored to give specific users and teams permissions to
initiate certain characteristics during the life cycle of the
specification.