Query Operators_AD

Вы просматриваете версию 17.0. Для самой новой информации, перейдите на страницу ((Query Operators))_AD для версии 21
 

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.

 

If you find an issue, select the text/image and pressCtrl + Enterto send us your feedback.
Примечание

Набор доступных функций зависит от вашего уровня доступа к продуктам Altium. Ознакомьтесь с функциями, включенными в различные уровни Подписки на ПО Altium, и функциональными возможностями приложений, предоставляемых платформой Altium 365.

Если вы не видите в своем ПО функцию, описанную здесь, свяжитесь с отделом продаж Altium, чтобы узнать больше.

Content