Altium Designer Documentation


Created: September 5, 2015 | Updated: August 13, 2021
Now reading version 20.0. For the latest, read: IIF for version 22

Parent page: System Query Functions - Arithmetic Functions


This is a special purpose construction which contains three queries. The value of the first query (between the opening bracket and the first comma) is evaluated. If that is True, the second query (between the commas) is returned; otherwise, the third query (between the second comma and closing bracket) is returned.

This Keyword is similar in concept to "If ... Then ... Else ..." constructions provided with many computer programming languages.


IIF(L : Boolean Query , A : Query , B : Query)

L, A, and B are all strings which each specify some Query; L needs to be a Boolean Query (i.e. of a nature that returns either a True or False result).

IIF(L,A,B) has an identical outcome to the Query comprised of ((L = True) And A) Or ((L = False) And B). As such, it is especially useful when L is of a complex nature, as it only needs to be specified once.

Example Usage

IsArc And IIF(ArcStopAngle - ArcStartAngle >= 0 , ArcStopAngle - ArcStartAngle Between 30 And 60 , ArcStartAngle - ArcStopAngle Between 300 And 330)
Returns all arcs that have an arc length which is greater than or equal to 30 degrees and less than or equal to 60 degrees. (The arc length property of an arc is an angle which is determined by subtracting its Start Angle property from its Stop Angle property. A complicating consideration is that it is possible for an arc's Stop Angle property to be smaller than its Start Angle property, but this Query correctly evaluates the true arc length property for all possible arc objects.)

IsComponent And IIF(Layer = 'Top Layer' , Rotation <> 0 , Rotation <> 180)
Returns all components that are on the top side of the PCB whose Rotation property is not 0 degrees, and all components that are on the bottom side of the PCB whose Rotation property is not 180 degrees. (Component objects can only reside on the Top signal layer or Bottom signal layer, so any component which is not on the Top signal layer must then be on the Bottom signal layer instead.)


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: