IIF

Now reading version 15.1. For the latest, read: IIF for version 21

Parent page: System Query Functions - Arithmetic Functions

Summary

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.

Syntax

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.)

 

If you find an issue, select the text/image and pressCtrl + Enterto send us your feedback.
Note

The features available depend on your Altium product access level. Compare features included in the various levels of Altium Designer Software Subscription and functionality delivered through applications provided by the Altium 365 platform.

If you don’t see a discussed feature in your software, contact Altium Sales to find out more.