Home Search

DriveWorks Pro 22
How To: Apply Line Item Numbers To Child Specifications (KB13120301)

Send Feedback

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 Index

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.

  1. 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.
  2. 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.

  1. 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.
  2. Select the variable and click Build to launch the rule builder.
  3. Select the Constants tab of the rule builder and double click the constant FixItemNumber. DWConstantFixItemNumber will appear in the rule window.
  4. 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.

  1. Select Specification Flow from the task explorer.
  2. If the default specification flow is in use click the Customize Specification button.
  3. Select Edit on the Specify state.
  4. Select Enter State from the State Items.
  5. From the Toolbox, select the task Drive Constant Value and...
  6. Drag it to the Task Sequence for 'Enter State' area
  7. 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.
  8. Enter the name of the constant to drive a value in, "FixItemNumber". Click OK to apply the rule and close the rule builder.
  9. Double Click the grey orb, next to the Constant Value property, so it turns green. Click the button to launch the rule builder.
  10. Select the constants tab in the rule builder and select the constant NextItemNumber. Click OK to apply the rule and close the rule builder.
  11. 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.

  1. 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.
  2. Select the Projects property for the child specification list and click the button to launch the Child Specification List editor.
  3. Select the Result Columns tab and enter Item Number in the Add Column field, Click Add.
  4. 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.

  1. 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.
  2. 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.
  3. In the wizard for the DCOUNT function select the name of the Child Specification List control from the Table field.
  4. In the Column field select the Name column
  5. 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 function
     DCOUNT(DWSubResultsChildSpecList1,3,"<>""")
  6. Click Add to add another variable, enter the name LastNumberUsed. This will determine the last number used.
  7. 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.
  8. In the wizard for the GETTABLEVALUE function select the name of the Child Specification List control from the Table field.
  9. In the Row Index field select the variable CountChildSpecs
  10. 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 function
     GetTableValue(DWSubResultsChildSpecList1,DWVariableCountChildSpecs,3)
  11. 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.
  12. In the If field paste the GETTABLEVALUE and at the end of this function type ="Item Number"
  13. In the Then field enter zero 0
  14. 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.  
    Modified GETTABLEVALUE function
     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.

  1. 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.
  2. Select the Projects property for the child specification list and click the button to launch the Child Specification List editor.
  3. 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.
  4. 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.
  5. 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
  6. Select the Then field and then select the variable LastItemNumberUsed, Type +1
  7. 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 function
     IF(DWVariableCountChildSpecs<=DWVariableLastItemNumberUsed,DWVariableLastItemNumberUsed+1,DWVariableCountChildSpecs)
  8. 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.
  9. Click OK to close the editor.
  10. Save the project.
  11. 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.