DriveWorks Hierarchical Control – Part Two
Article by Lee Herron updated September 21, 2017
Article
In this DriveWorks Tech Tips blog post we continue from part one to look at ways to use DriveWorks Hierarchical Properties to build our forms more quickly and make them smarter. In the video below we show the creation of a more responsive table out of labels, which once setup, can be quickly expanded to any required size as the rule is self-aware.
The DriveWorks hierarchical properties we will be using here are:
Height | ControlName .Height |
---|---|
Left | ControlName .Left |
Top | ControlName .Top |
Width | ControlName .Width |
These are the main properties we will be using, but there are many more available. You can get a complete list of them here: http://docs.driveworkspro.com/Topic/HowToControlProperties
In today’s example we will use labels to create a more dynamic and adjustable version of a table. This idea comes up quite frequently as companies often want to show a summary of items or properties at the end of a configuration process.
The image below shows the labels we are starting with. Note that all the names contain a number at the end. This is a critical feature when creating smart control quickly because when you copy and paste a control with a number on the end, DriveWorks will automatically name it to the next available increment.

DriveWorks Hierarchical Control Labels
To take advantage of this, we need to be able to bring the name of the control itself inside our DriveWorks rule. To do this we will use a function called MyName which will bring the name of the control and sub property into our rule.
Find out more about MyName in the Driveworks Pro Help File: http://docs.driveworkspro.com/Topic/MyName?terms=myname
An example of this in action would look like this:
And would result in this:
As you can see, we get the Item2 name and the sub property of that control as well in the return.
Next, we want to be able to pull out various pieces of this return in our rule. In this case, we want the number at the end of the control. To do this we use a function called ExtractNumber.
Find out more about ExtractNumber in the Driveworks Pro Help File – http://docs.driveworkspro.com/Topic/ExtractNumber?terms=extract%20number
ExtractNumber essentially looks at a piece of text, dynamic or static, and goes through it looking for numbers. It allows users to easily pull out numbers from anywhere in the text. It also allows users to pull out different numbers if the string has multiple numbers in it.
For example:
ExtractNumber(Item2.top,1) = 2
This would result in 2, since 2 is the first (and only) number in the string.
If we had multiple numbers in the string we would do the following:
ExtractNumber(Item2_1.top,2) = 1
This results in 1 because we asked for the second number that appears in the string.
Don’t forget to download the example files here.
There are other functions that we commonly use with the MyName function, look for those in upcoming DriveWorks Tech Tip blog posts!
Related Links
Get Certified SOLIDWORKS Services from Javelin
Javelin Experts can help you to: