Altium Designer Documentation

Component & Library Query Functions in Altium Designer

Created: July 13, 2021 | Updated: August 17, 2021
All Contents

Parent page: Working with the Query Language

Component and library query functions shown in the Query Helper dialog Component and library query functions shown in the Query Helper dialog

Underlying Altium Designer's schematic and PCB editors is a powerful query engine. By entering queries into this engine you can logically scope precisely those objects you require.

A query is a string you enter using specific keywords and syntax, which will return the targeted objects. There are many keywords available, allowing you to target objects by their type, their properties, or both.

For a detailed overview of using the query language, see Working with the Query Language.

This reference page details the query language keywords available when searching for file-based components in Altium Designer. For help on a specific query keyword, use the following collapsible sections or highlight (or click inside) any given keyword - in the Query Helper.

To access the component and library query functions, click the Helper button found in the File-based Libraries Search dialog.

Components

Summary

Returns all components whose Comment complies with the Query.

Syntax

Comment : String

Example Usage

Comment = 'Res1'
Returns all components whose Comment is Res1.

Comment = '100nF'
Returns all components whose Comment is 100nF.

Comment Like '*33*'
Returns all components whose Comment contains 33.

Tips

  • Ensure that the scope of the search is set to Components, using the Search in field in the File Libraries Search dialog.
  • When searching components, all SchLib and IntLib libraries - available, or along a defined search path - will be interrogated.
  • All results are listed in the Query Results listing, back in the Components panel.

Summary

Returns all components whose Component Type property complies with the Query.

Syntax

ComponentType = ComponentType_String

ComponentType_String must be one of the strings from the following list:

  • 'Graphical'
  • 'Jumper'
  • 'Mechanical'
  • 'Net Tie'
  • 'Net Tie (In BOM)'
  • 'Standard'
  • 'Standard (No BOM)'

Example Usage

ComponentType = 'Graphical'
Returns all components whose Component Type is Graphical.

ComponentType = 'Standard'
Returns all components whose Component Type is Standard.

Tips

  • Ensure that the scope of the search is set to Components, using the Search in field in the File Libraries Search dialog.
  • When searching components, all SchLib and IntLib libraries - available, or along a defined search path - will be interrogated.
  • All results are listed in the Query Results listing, back in the Components panel.
  • The single quote characters (') at the start and end of ComponentType_String are mandatory.

Summary

Returns all components whose Designator property complies with the Query.

Syntax

Designator : String

Example Usage

Designator = 'U2'
Returns all components whose Designator property is U2.

Designator Like '*Channel*'
Returns all components whose Designator property includes Channel.

Designator <> 'C*'
Returns all components except those whose Designator property starts with C.

Tips

  • Ensure that the scope of the search is set to Components, using the Search in field in the File Libraries Search dialog.
  • When searching components, all SchLib and IntLib libraries - available, or along a defined search path - will be interrogated.
  • All results are listed in the Query Results listing, back in the Components panel.

Summary

Returns each component that is linked to (or references) a domain model whose properties comply with the Query.

Each component can be linked to models of Footprint, Simulation, PCB3D, Ibis, and Signal Integrity types. It is possible to link a component to more than one model of the same type, but only one model of each type can be selected as a component's Current Model.

Syntax

HasModel(ModelType : String,ModelName : String,CurrentModelOnly : Boolean) : Boolean/Boolean_String

The ModelType string specifies the Type property of a linked model, and must be one of the strings from the following list:

  • 'PCB3DLIB' - use this string to target a linked model whose Type property is PCB3D.
  • 'PCBLIB' - use this string to target a linked model whose Type property is Footprint.
  • 'IBIS' - use this string to target a linked model whose Type property is Ibis Model.
  • 'SI' - use this string to target a linked model whose Type property is Signal Integrity.
  • 'SIM' - use this string to target a linked model whose Type property is Simulation.

The ModelName string specifies the Name property of a linked Model.

The CurrentModelOnly parameter specifies whether or not the linked model has to be a Current Model of each component. When this is False, the linked model does not have to be a Current Model (but it still can be); when this is True, the linked model does have to be a Current Model.

Example Usage

HasModel('PCBLIB','SOIC14',False)
HasModel('PCBLIB','SOIC14',False) = True
HasModel('PCBLIB','SOIC14',False) = 'True'

Returns all components that are linked to a Footprint Model whose Name property is SOIC14; that Model does not have to be each component's Current Footprint Model (but it can be).

HasModel('PCBLIB','DIP14',True)
HasModel('PCBLIB','DIP14',True) = True

HasModel('PCBLIB','DIP14',True) = 'True'
Returns all components that are linked to a Footprint Model whose Name property is DIP14; that Model must be the Current Footprint Model for the component.

HasModel('SI','RES1',False)
HasModel('SI','RES1',False) = True
HasModel('SI','RES1',False) = 'True'

Returns all components that are linked to a Signal Integrity Model whose Name property is RES1; that Model does not have to be each component's Current Signal Integrity Model (but it can be).

HasModel('SIM','RESISTOR',True)
HasModel('SIM','RESISTOR',True) = True
HasModel('SIM','RESISTOR',True) = 'True'

Returns all components that are linked to a Simulation Model whose Name property is RESISTOR; that Model must be the Current Simulation Model for the component.

Tips

  • Ensure that the scope of the search is set to Components, using the Search in field in the File Libraries Search dialog.
  • When searching components, all SchLib and IntLib libraries - available, or along a defined search path - will be interrogated.
  • All results are listed in the Query Results listing, back in the Components panel.

Summary

Returns each component that is linked to (or references) a domain model, containing a parameter object whose Parameter Name and Value properties comply with the Query.

Each component can be linked to models of Footprint, Simulation, PCB3D, Ibis, and Signal Integrity types. It is possible to link a component to more than one model of the same type, but only one model of each type can be selected as a component's Current Model.

Syntax

HasModelParameter(Parameter Name : String,Value : String,CurrentModelOnly : Boolean) : Boolean/Boolean_String

The CurrentModelOnly parameter specifies whether or not the linked model (which contains a compliant parameter) has to be a Current Model of each component. When this is False, the linked model does not have to be a Current Model (but it still can be); when this is True, the linked model does have to be a Current Model.

Example Usage

HasModelParameter('Inductance A','1mH',False)
HasModelParameter('Inductance A','1mH',False) = True
HasModelParameter('Inductance A','1mH',False) = 'True'

Returns all components that are linked to a model that contains a parameter object whose Parameter Name property is Inductance A, and whose Value property is 1mH. That model does not have to be a Current Model of each component (but it can be).

HasModelParameter('Coupling Factor','0.999',True)
HasModelParameter('Coupling Factor','0.999',True) = True
HasModelParameter('Coupling Factor','0.999',True) = 'True'

Returns all components that are linked to a model that contains a parameter object whose Parameter Name property is Coupling Factor, and whose Value property is 0.999. That model must be a Current Model of the component.

Tips

  • Ensure that the scope of the search is set to Components, using the Search in field in the File Libraries Search dialog.
  • When searching components, all SchLib and IntLib libraries - available, or along a defined search path - will be interrogated.
  • All results are listed in the Query Results listing, back in the Components panel.

Summary

Returns all components whose Library Reference property complies with the Query.

Syntax

LibReference : String

Example Usage

LibReference = 'LM833'
Returns all components whose Library Reference property is LM833.

LibReference Like 'C*'
Returns all components whose Library Reference property starts with C.

Tips

  • Ensure that the scope of the search is set to Components, using the Search in field in the File Libraries Search dialog.
  • When searching components, all SchLib and IntLib libraries - available, or along a defined search path - will be interrogated.
  • All results are listed in the Query Results listing, back in the Components panel.

Summary

Returns all components whose Part Count property complies with the Query.

Syntax

PartCount : Number

Example Usage

PartCount = 2
Returns all components whose Part Count is 2.

PartCount > 4
Returns all components whose Part Count is greater than 4 (i.e. all multi-part components containing more than 4 sub-parts).

Tips

  • Ensure that the scope of the search is set to Components, using the Search in field in the File Libraries Search dialog.
  • When searching components, all SchLib and IntLib libraries - available, or along a defined search path - will be interrogated.
  • All results are listed in the Query Results listing, back in the Components panel.

Summary

Returns all components whose Pin Count property complies with the Query.

Syntax

PinCount : Number

Example Usage

PinCount = 2
Returns all components whose Pin Count is 2.

PinCount > 14
Returns all components whose Pin Count is greater than 14.

Tips

  • Ensure that the scope of the search is set to Components, using the Search in field in the File Libraries Search dialog.
  • When searching components, all SchLib and IntLib libraries - available, or along a defined search path - will be interrogated.
  • All results are listed in the Query Results listing, back in the Components panel.

All

Summary

Returns all components, or footprints, whose Description property complies with the Query.

Syntax

Description : String

Example Usage

Description = 'TTL-RS232 DRIVER'
Returns all components, or footprints, whose Description property is TTL-RS232 DRIVER.

Description Like '*RS485*'
Returns all components, or footprints, whose Description property includes RS485.

Tips

  • The entities returned - Components or Footprints - depends on the chosen scope, defined using the Search in field in the File Libraries Search dialog.
  • All results are listed in the Query Results listing, back in the Components panel.

Summary

Returns all components containing a parameter object whose Parameter Name and Value properties comply with the Query.

Syntax

HasParameter(Parameter Name : String,Value : String) : Boolean/Boolean_String

Example Usage

HasParameter('Comment','1K')
HasParameter('Comment','1K') = True
HasParameter('Comment','1K') = 'True'

Returns all components that contain a parameter object whose Parameter Name property is Comment, and whose Value property is 1K.

Tips

  • The entities returned - Components or Footprints - depends on the chosen scope, defined using the Search in field in the File Libraries Search dialog.
  • All results are listed in the Query Results listing, back in the Components panel.

Summary

Returns all components, or footprints, whose parent library name complies with the Query.

Syntax

LibraryName : String

Example Usage

LibraryName = 'Miscellaneous Devices.SchLib'
Returns all components whose parent library is Miscellaneous Devices.SchLib.

LibraryName Like 'Miscellaneous*.IntLib'
Returns all components, or footprints, whose parent library name starts with Miscellaneous and ends with .IntLib.

LibraryName Like '*Vishay*'
Returns all components whose parent library name contains Vishay.

Tips

  • The entities returned - Components or Footprints - depends on the chosen scope, defined using the Search in field in the File Libraries Search dialog.
  • When searching components, all SchLib, IntLib and DbLib libraries - available, or along a defined search path - will be interrogated. When searching footprints, all PcbLib and IntLib libraries will be interrogated.
  • All results are listed in the Query Results listing, back in the Components panel.

Summary

Returns all components, or footprints, that are resident in the library specified as part of the Query.

Syntax

LibraryPath : String

Example Usage

LibraryPath = 'C:\Documents\Altium\Library\MyExampleLibrary.SchLib'
Returns all components whose parent library is MyExampleLibrary.SchLib, and where that library is resident in the  C:\Documents\Altium\Library folder.

LibraryPath Like ' C:\Documents\Altium\Library\Miscellaneous*.IntLib'
Returns all components, or footprints, whose parent library name starts with Miscellaneous and ends with .IntLib, and where that library is resident in the  C:\Documents\Altium\Library folder.

LibraryPath = 'C:\Test Projects\Example DBLib\VishayCapacitor.DBLib'
Returns all components whose parent library is VishayCapacitor.DBLib, and where that library is resident in the  C:\Test Projects\Example DBLib folder.

Tips

  • The entities returned - Components or Footprints - depends on the chosen scope, defined using the Search in field in the File Libraries Search dialog.
  • When searching components, all SchLib, IntLib and DbLib libraries - available along the defined library path - will be interrogated. When searching footprints, all PcbLib and IntLib libraries will be interrogated.
  • All results are listed in the Query Results listing, back in the Components panel.

Summary

Returns all components, or footprints, whose name complies with the Query.

Syntax

Name : String

Example Usage

Name = 'Res1'
Returns all components, or footprints, whose name is Res1.

Name Like 'DIP*'
Returns all components, or footprints, whose name starts with DIP.

Name Like '*33*'
Returns all components, or footprints, whose name contains 33.

Tips

  • The entities returned - Components or Footprints - depends on the chosen scope, defined using the Search in field in the File Libraries Search dialog.
  • When searching components, all SchLib and IntLib libraries - available, or along a defined search path - will be interrogated. When searching footprints, all PcbLib and IntLib libraries will be interrogated.
  • All results are listed in the Query Results listing, back in the Components panel.
  • For a schematic component, the name is checked against its Design Item ID property. For a PCB Footprint, the name is checked against its Footprint property.

Summary

Returns all components, or footprints, whose parent source library name complies with the Query.

Syntax

SourceLibraryName : String

Example Usage

SourceLibraryName = 'Miscellaneous Devices.SchLib'
Returns all components whose parent source library is Miscellaneous Devices.SchLib.

SourceLibraryName = 'Miscellaneous Devices.PcbLib '
Returns all footprints whose parent source library is Miscellaneous Devices.PcbLib.

Tips

  • The entities returned - Components or Footprints - depends on the chosen scope, defined using the Search in field in the File Libraries Search dialog.
  • When searching components, only source schematic libraries - available, or along a defined search path - will be interrogated. When searching footprints, only PCB libraries will be interrogated.
  • All results are listed in the Query Results listing, back in the Components panel.

Summary

Returns all components, or footprints, that are resident in the source library specified as part of the Query.

Syntax

SourceLibraryPath : String

Example Usage

SourceLibraryPath = ' C:\Documents\Altium\Library\MyExampleLibrary.SchLib'
Returns all components whose parent source library is MyExampleLibrary.SchLib, and where that library is resident in the  C:\Documents\Altium\Library folder.

SourceLibraryPath = ' C:\Documents\Altium\Library\Miscellaneous Devices.PcbLib'
Returns all footprints whose parent source library is Miscellaneous Devices.PcbLib, and where that library is resident in the  C:\Documents\Altium\Library folder.

SourceLibraryPath Like ' C:\Documents\Altium\Library\*'
Returns all components, or footprints, whose parent source library is resident in the  C:\Documents\Altium\Library folder.

Tips

  • The entities returned - Components or Footprints - depends on the chosen scope, defined using the Search in field in the File Libraries Search dialog.
  • When searching components, only schematic libraries - available along the defined library path - will be interrogated. When searching footprints, only PCB libraries will be interrogated.
  • All results are listed in the Query Results listing, back in the Components panel.

Footprints

Summary

Returns all footprints whose Height property complies with the Query.

Syntax

Height : Number

Number will follow the measurement units currently employed for the library – either Imperial (mil; 1mil = 0.001inch) or Metric (mm; 1mm = 0.001meter).

Example Usage

Height = 300
Returns all footprints that have a Height property which is equal to 300 current measurement units.

Height >= 5.08
Returns all footprints that have a Height property which is greater than or equal to 5.08 current measurement units.

Height <> 550
Returns all footprints that have a Height property which is not equal to 550 current measurement units.

Tips

  • Ensure that the scope of the search is set to Components, using the Search in field in the File Libraries Search dialog.
  • When searching footprints, all PcbLib and IntLib libraries - available, or along a defined search path - will be interrogated.
  • All results are listed in the Query Results listing, back in the Components panel.

Summary

Returns all footprints whose Pad Count property complies with the Query.

Syntax

PadCount : Number

Example Usage

PadCount = 2
Returns all footprints whose Pad Count is 2.

PadCount > 14
Returns all footprints whose Pad Count is greater than 14.

Tips

  • Ensure that the scope of the search is set to Components, using the Search in field in the File Libraries Search dialog.
  • When searching footprints, all PcbLib and IntLib libraries - available, or along a defined search path - will be interrogated.
  • All results are listed in the Query Results listing, back in the Components panel.
Found an issue with this document? Highlight the area, then use Ctrl+Enter to report it.

Contact Us

Contact our corporate or local offices directly.

We're sorry to hear the article wasn't helpful to you.
Could you take a moment to tell us why?
200 characters remaining
You are reporting an issue with the following selected text
and/or image within the active document: