Query Operators

Modified by Jason Howie on May 15, 2018
All Contents

Parent page: Query Language Reference

This page provides a summary of the operators that can be used when defining logical query expressions with the Query Language.

Arithmetic Operators

Operator Description Example
+ Addition operator NetPinCount + NetViaCount
- Subtraction operator ArcStopAngle - ArcStartAngle
* Multiplication operator PadXSize_BottomLayer * PadYSize_BottomLayer
/ Division operator HoleDiameter / ViaDiameter
Div Integral division operator Color Div 65536
This calculates Color divided by 65536 and the fractional part of the result is discarded
Mod Modulus operator Color Mod 256
This calculates the remainder when Color is divided by 256, without determining the fractional part of the result

Logical Operators

Operator Description Example
And Logical AND operator IsPad And OnMultiLayer
To be returned, an object has to be a pad, and reside on the Multi-Layer layer
&& Logical AND operator
(lower precedence)
IsPad && OnMultiLayer
To be returned, an object has to be a pad, and reside on the Multi-Layer layer
Or Logical OR operator IsPad Or IsVia
To be returned, an object has to either be a pad, or a via
|| Logical OR operator
(lower precedence)
IsPad || IsVia
To be returned, an object has to either be a pad, or a via
Xor Logical EXCLUSIVE OR operator OnMultiLayer Xor (HoleDiameter <> 0)
To be returned, an object has to either be on the Multi-Layer layer and have a Hole Diameter that is zero, or not
be on the Multi-Layer layer and have a Hole Diameter that is not zero.
Not Logical NOT operator Not OnMultiLayer
To be returned, an object has to not be on the Multi-Layer layer

Comparison Operators

Operator Description Example
< Less Than operator HoleDiameter < 40
To be returned, an object has to have a Hole Diameter which is less than 40
<= Less Than Or Equal To operator HoleDiameter <= 40
To be returned, an object has to have a Hole Diameter which is less than, or equal to 40
>= Greater Than Or Equal To operator HoleDiameter >= 40
To be returned, an object has to have a Hole Diameter which is greater than, or equal to 40
> Greater Than operator HoleDiameter > 40
To be returned, an object has to have a Hole Diameter which is greater than 40
<> Not Equal To operator HoleDiameter <> 40
To be returned, an object has to have a Hole Diameter which is not equal to 40
= Equal To operator HoleDiameter = 40
To be returned, an object has to have a Hole Diameter which is equal to 40
Between...And... Inclusive range operator HoleDiameter Between 30 And 50
To be returned, an object has to have a Hole Diameter that is greater than, or equal to 30, and
less than, or equal to 50.
Like Like operator Name Like 'ADDR?*'
This returns objects having a Name property whose associated (text) string begins with ADDR and
which contains at least one more character

Wild Card Characters

Wild Card characters permit the provision of strings which are not exactly specified. These characters are typically used in conjunction with other characters, resulting in the provision of strings which are partially specified. A few exceptional keywords can accept string parameters that are not exactly specified, but for the most part, strings can only contain Wild Card characters when these are being compared by the Like operator.

Operator Description Example
? This can be replaced by a single character of any type Footprint Like 'DIP1?'
This returns objects which have a Footprint property of DIP10, or DIP12, or DIP14, etc.
* This can be replaced by any number of characters, each of which can be of any type Footprint Like 'SIP*'
This returns objects which have a Footprint property of SIP1, or SIP12, or SIP216, etc. (Any objects having a Footprint property of SIP are also returned, because '*' can also be replaced by no characters)

Boolean Strings

Operator Description Example
True This affirms the meaning of a Keyword IsPad = True
To be returned, an object has to be a pad
False This negates the meaning of a Keyword IsVia = False
To be returned, an object has to not be a via

Brackets and Order of Precedence

It is worthwhile taking a look at the order of precedence in place for the operators used in logical Query expressions. After all, without such knowledge, an expression may not target the objects required.

Brackets have the highest precedence within an order of precedence that has been defined for the various operators, and which determines how queries are interpreted by the software (whenever the user has not provided brackets). The sequence of this order, from highest to lowest, is as follows:

  1. Brackets
  2. Not
  3. ^, *, /, Div, Mod, And
  4. +, -, Or, Xor
  5. =, <>, <, >, <=, >=
  6. &&, ||
This order of precedence is similar to that used in Pascal-type languages. Ambiguities are resolved by working from left to right. Brackets are evaluated from inside to outside and equal levels are evaluated left to right.
It is highly advisable to use brackets whenever there is any possibility, whatsoever, that the query might not be correctly interpreted. Generous usage of brackets removes doubt and makes the resulting queries easier to read by others.

 

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.

You are reporting an issue with the following selected text
and/or image within the active document:
ALTIUM DESIGNER FREE TRIAL
Altium Designer Free Trial
Let’s get started. First off, are you or your organization already using Altium Designer?

If would like to speak with a representative, please contact your local Altium office.
Copyright © Altium Limited

In that case, why do you need an evaluation license?

If would like to speak with a representative, please contact your local Altium office.
Copyright © Altium Limited

Got it. You actually don’t need an evaluation license for that.

Click the button below to download the latest Altium Designer installer.


Download Altium Designer Installer

If would like to speak with a representative, please contact your local Altium office.
Copyright © Altium Limited

Please fill out the form below to get a quote for a new seat of Altium Designer.

By clicking “Get Your Free Trial”, you are agreeing to our Privacy Policy.
You may receive communications from Altium and can change your notification preferences at any time.

If you are on Altium Subscription, you don’t need an evaluation license.

If you are not an active Altium Subscription member, please fill out the form below to get your free trial.

By clicking “Get Your Free Trial”, you are agreeing to our Privacy Policy.
You may receive communications from Altium and can change your notification preferences at any time.

Why are you looking to evaluate Altium Designer?

If would like to speak with a representative, please contact your local Altium office.
Copyright © Altium Limited

You came to the right place! Please fill out the form below to get your free trial started.

By clicking “Get Your Free Trial”, you are agreeing to our Privacy Policy.
You may receive communications from Altium and can change your notification preferences at any time.

Sounds exciting! Did you know we offer special discounted student licenses? For more information, click here.

In the meantime, feel free to request a free trial by filling out the form below.

By clicking “Get Your Free Trial”, you are agreeing to our Privacy Policy.
You may receive communications from Altium and can change your notification preferences at any time.

Got it. You can download a free Altium Designer Viewer license which is valid for a 6 months.

Please fill out the form below to request one.

By clicking “Get Your Free Trial”, you are agreeing to our Privacy Policy.
You may receive communications from Altium and can change your notification preferences at any time.

That’s great! Making things is awesome. We have the perfect program for you.

Upverter is a free community-driven platform designed specifically to meet the needs of makers like you.

Click here to give it a try!

If would like to speak with a representative, please contact your local Altium office.
Copyright © Altium Limited

Got it. You can download a free Altium Designer Viewer license which is valid for a 6 months.

Please fill out the form below to request one.

By clicking “Get Your Free Trial”, you are agreeing to our Privacy Policy.
You may receive communications from Altium and can change your notification preferences at any time.