Certified SOLIDWORKS® Solution Partner|Built for SOLIDWORKS and SOLIDWORKS PDM Professional|Free Community Edition, no key needed

Product features

External Sources and Advanced Formulas: SQL Data in SOLIDWORKS

External Sources and Advanced Formulas in PDMPublisher pull SQL Server values and named expressions into filenames, folders, properties and annotations.

The released filename is the part number plus the revision. The destination folder depends on a project code in the ERP database. The material on a drawing stamp lives in a SQL table nobody wants to retype as a property. External Sources and Advanced Formulas are the two shared resources that make those values available anywhere PDMPublisher names a file, picks a folder or fills a property.

In short

  • An External Source is one SELECT statement against SQL Server with parameters mapped to document values; its result can be inserted into filenames, folders, properties and annotations.
  • An Advanced Formula is a named expression built from functions, properties and sources, reused across every profile.
  • Credentials stay local: they never travel with exports, PIN shares or Company Settings.

How it works

Advanced Formula editor in PDMPublisher for SOLIDWORKS with the Name, Value / Equation, Evaluates to and Comments columns, a Sample formula whose equation =FilenameWithoutExtension evaluates to AB-1234, the Sample input field and the OK and Cancel buttons
The Advanced Formula editor: type an expression, insert functions and sources, and Evaluate it.
  1. Under PDMPublisher > Settings > External Sources, add a source: a connection, one SELECT statement, parameters such as @Configuration mapped to document fields, and the result column to use. Test it.
  2. Under Advanced Formulas, name a formula and type the expression; insert functions and sources from the arrow menu and check it with Evaluate.
  3. Insert the source or formula from the arrow menu of any filename, folder, property or annotation box.
  4. Values are resolved when the job runs, for the document each row belongs to.
External Source editor in PDMPublisher for SOLIDWORKS showing the Source name and SQL Server connection fields, a SELECT Material FROM PartProperties WHERE Configuration = @Configuration query, the Parameters grid with SQL parameter, Source field and Test value columns, the Result mapping section with Choose columns and Result column, and the Test query, Save and Cancel buttons
The External Source editor: one SELECT statement, parameters mapped to document fields, a result column.

Settings that matter

SettingWhat to putWhy
Parameters@Configuration mapped to the configuration name, sayThe query runs per document row with that row’s values.
Choose columnsThe one result column to useA query that returns several columns still yields one value.
Formula nameReleased filename, sayInserted by name; change it once and every profile follows.
Export all settingsBefore a broad changeOne shared formula can affect several profiles; keep a bundle to go back to.
External Sources page in the PDMPublisher for SOLIDWORKS Settings dialog listing saved SQL Server sources with the Add, Edit / Test and Delete buttons
The External Sources settings page lists every source by name.

Recipes

You wantSetYou get
Material from ERP in Property DoctorSource SELECT Material FROM PartProperties WHERE Configuration = @Configuration; fill the Material column from the External source submenuMaterials filled from the database, previewed before Apply.
One released filename for every copyFormula {PartNumber}-{Revision} inserted in Publish and Save As NewEvery output and copy named the same way.
A destination folder per project codeSource returning the project folder for @ProjectNumber, inserted in Export locationFiles filed where the ERP says they belong.

If something looks wrong

  • The query test succeeds but the document gets an empty value: a parameter is mapped to a field that is empty for that document.
  • After importing a configuration, sources fail: re-enter the credentials; they are never included in exports.
  • A formula evaluates differently in a profile: it is resolved for the document row where it is applied; check the row.
  • The functions list seems incomplete: there is no fixed list; the arrow menu shows what the current build supports.

Availability

External Sources and Advanced Formulas is part of PDMPublisher for SOLIDWORKS, the add-in that runs inside SOLIDWORKS. They are shared resources of the add-in; the PDM task has its own SQL query placeholders for annotations.

Keep going

Documentation

Frequently asked questions

Can PDMPublisher read values from a SQL Server database?

Yes. Define an External Source under Settings > Shared Resources > External Sources with a connection string, one SELECT statement and parameters mapped to document fields. The source then appears in the External source submenu of supported property, formula, filename and folder menus.

What is an Advanced Formula in PDMPublisher for SOLIDWORKS?

A named equation, such as =FilenameWithoutExtension, that is evaluated for the document and configuration being processed. Formulas are inserted by name into Save As New, Clone Tree, Property Doctor and supported publishing templates, so one definition drives every workflow.

Are SQL passwords included when I export or share settings?

No. Connection strings are protected for your Windows account and are excluded from settings bundles, PIN shares and Company Settings. Re-enter them on the destination computer after importing.

What is the difference between an External Source and an annotation SQL query?

An External Source is a reusable definition available to property, filename and folder menus in the SOLIDWORKS add-in. An annotation SQL query is configured inside a Publish profile’s annotation with the ($SQL-Filename), ($SQL-Part), ($SQL-Assembly) and ($SQL-Drawing) placeholders and travels with that profile.

Why does my query test succeed but the document gets an empty value?

A successful connection does not guarantee that every document returns a row. Check the parameter mapping and the value the document actually supplies, and define the expected empty-result behavior in the consuming workflow.

Where is the list of formula functions?

The functions and sources available on your installation are listed in the arrow and right-click menus of the Value / Equation cell in the formula editor. Use the Sample input field and the Evaluates to column to preview the result before saving.

Where to next

PDMPublisher for SOLIDWORKS · PDMPublisher for PDM Professional · All features · Conversion guides · Pricing · Documentation · Contact

The SOLIDWORKS add-in is free to start as the Community Edition. The PDM Professional task comes with a 7-day trial. Download the add-in or start the task trial.