SOLIDWORKS PDM: Making a Dynamic Dropdown for your Datacards
In SOLIDWORKS PDM, you can insert a Combobox Dropdown that will allow you to either type in an entry or choose from a list. What if you want your typed entries to show the next time you use that dropdown? This is possible through the use of a list that is based on a SQL query. First, you will want to create a list that will contain the items you would like to start with in your dropdown. In this example, I have created a list called Start Customers.
Next, you will create your query-based list. Add a new list and for Data type choose From SQL Database. Type in the following query:
SELECT DISTINCT VariableValue.ValueCache
FROM Variable INNER JOIN
VariableValue ON Variable.VariableID = VariableValue.VariableID
WHERE (Variable.VariableName LIKE ‘<variable name>’) AND VariableValue.ValueCache !=”
UNION
SELECT DISTINCT cardlistvalues.value
FROM Cardlistvalues INNER JOIN
CardLists ON CardListValues.CardListId = CardLists.Id
WHERE CardLists.Name = ‘<start list name>’
You must replace <variable name> with the variable you will be assigning to the Dropdown and <start list name> with the list you created for your initial values. The server, database, login, and password should all be pointing to your EPDM database server. Set the Refresh to Periodic refresh every 1 minutes. Be sure to test the list and save.
Now you are ready to use it in your datacard!
TIP: Be sure to use Dropdown instead of Droplist or you will not be able to type new values in. For Items, choose Special Value and choose the name of the SQL based list.
Related Articles
EPDM Tech Tip: How to Use An Options File for EPDM in 2015
EPDM Tech Tip: How to Handle a Full Archive Server
How to Link Word and Excel Documents to EPDM Datacards
Maintaining a Healthy SQL Server for EPDM
SOLIDWORKS Tip: Meshing Tips and Tools for Better Results
SOLIDWORKS Tip: Meshing Tips and Tools for Better Results
For more training and tutorials on the many 3D CAD Modeling solutions in the SolidWorks family of products and add-ons, please feel free to look through our Webcast Archive, register for an upcoming webcast or event, or look into our 3DU SolidWorks Training and Certification courses.