Trimech-Main-Site-Group-Navigation Trimech-Main-Site-Group-Navigation Trimech-Main-Site-Group-Navigation Solid-Solutions-Group-Navigation Javelin-Group-Navigation Solid-Print-Group-Navigation 3DPRINTUK-Group-Navigation Trimech-Enterprise-Solutions-Group-Navigation Trimech-Enterprise-Solutions-Group-Navigation Trimech-Advanced-Manufacturing-Group-Navigation Trimech-Staffing-Solutions-Group-Navigation
With over 35 years of experience, the TriMech Group offers a comprehensive range of design, engineering, staffing and manufacturing solutions backed by experience and expertise that is unrivalled in the industry. The TriMech Group's solutions are delivered by the divisions and brands shown here, use the links above to visit the group's websites and learn more.
x
Search

Using an Input Formula in an EnterprisePDM FileCard Control

Thursday July 23, 2015 at 11:19am
SOLIDWORKS EnterprisePDM DataCards for Files, Folders and Searching all support Input Formula that allow for text substitution, manipulation and mathematical calculations. This blog will discuss an example of String Manipulation that resulted from a recent Support Call to the Solid Solutions' EnterprisePDM Support Line.

Recently I took a call on the help-desk from a Customer who, after modifying the File Card associated with SOLIDWORKS files, had a requirement to populate two new variables on that Card with information extracted from an already populated Variable.

Original DataCard Values

Originally the File Card had a Variable called 'Description' which was populated, on creation from a Template, by selecting a standard 'category' from a list which was then concatenated with a manually typed 'description' and separated with a hyphen ( - ). The redesigned File Card now has these two items separated to assist in Search and BOM Reporting requirements. Moving forward this is not a problem, however there are lots of legacy files that need to be updated. 

We considered a number of options, two of which involved Customisation of some sort (Dispatch or the creation of a bespoke API Add-In) and decided that we should investigate what could be done out of the box first, using an input formula. 

Within the EnterprisePDM Help file, an input formula is defined as having the following purpose... "Use the Input Formula dialog box to populate an edit box control with a string built up by values from variables linked to other controls on the data card."  ...so it should be capable of doing what we require. 

Input formula can be used for two main reasons, the first of these being to display an 'Alias' value based on the value of another Variable on the Card.

The format of an alias in an input formula can be seen as follows:

%VARIABLENAME(VALUE1=ALIAS1, VALUE2=ALIAS2)%

Where VALUEn is the entered value in variable VARIABLENAME and ALIASn is the evaluated value that is displayed in the control driven by this input formula.

This works in a similar manner to an Alias List, but has the added benefit of allowing both the source value and alias value to be retained (and therefore usable as Custom Properties in SOLIDWORKS files). There is a limitation however that this formula cannot exceed 1000 chrs so in longer lists, or in shorter lists with longer values, it is not practical. 

The second function (and the focus of this Blog) is to manipulate a Variable using string and arithmetic functions to determine the value returned by the input formula.

A full list of Functions is available within the EnterprisePDM Help files and will not be covered here, we can however break them down into three areas.

  • Arithmetic Functions: Add / Subtract / Multiply / Divide
  • String Functions: Left / Right / Middle/ Token / Length / Find / Reverse 
  • System Information: Time

Each of these Functions requires one or more inputs to determine the output, for example with Add we supply two values... 

Add(<term1>,<term2>)

...the 'terms' here can be existing Variables from the Card, predefined text (numbers in this case) or even a secondary Function. 

To solve this particular problem we will need to make use of Length, Find, Left, Right, Add and Subtract and need to be careful how we construct the final function to make sure it evaluates correctly in the right order.  

Getting the information to the left of the hyphen is pretty straightforward. We simply need to use a Left function alongside a Find function to locate the hyphen's position within that Variable.  To insert a formula, select the Variable Control on the File Card then from the properties panel use the fly out menu alongside the 'Input Formula' box to add the function you require, or the variable you want to add into that formula.

 

The result looks like this...

 

Getting the data from the Right of the hyphen is a little more tricky since the 'Find' function works from the left and starts it's count from '0'. There is also a space alongside the hyphen that we want to remove from the final string.  To create this variable I therefore need to combine quite a few functions that allow me to determine the complete length of the Description and the position from the left of the hyphen. I then need to Subtract these to determine the letters to the Right of the hyphen whilst also adding '2' to ensure we ignore the hyphen and the 'space' in the result.  The final function now looks like....

The other thing that we need to bear in mind when it comes to an Input Formula is that, currently, a Formula will only evaluate if one of the Variables in the equation changes via manual intervention, which in this case means I have to Check Out the Part and make a Change to the 'Description' (this could literally just be hitting SPACE then DELETE) in order for the formulas to both update as below...

Thanks for reading I hope you found this of interest

By Wayne Marshall
Customer Support Manager
Solid Solutions Management Ltd. 

 

 

 

Related Blog Posts

How to Move a Sketch in SOLIDWORKS
If you need to move a sketch in SOLIDWORKS, then you may find that it can be surprisingly tricky! But after you learn this tip, you'll never need to worry about moving a sketch again!
The Best Hardware for SOLIDWORKS in 2025
SOLIDWORKS 2025 is here! So it’s important to check in on your hardware and make sure it will serve you well and most importantly, that it can run SOLIDWORKS 2025 happily.
A Step-by-Step Guide to Adding Dynamic Previews to
Learn how to create 3D Documents and generate dynamic form previews in DriveWorks.

 Solid Solutions | Trimech Group

MENU
Top