** ** | **Product(s):** | OpenBuildings Generative Components | |

** ** | **Version(s):** | CONNECT Edition | |

** ** | **Environment: ** | N\A | |

# Background

You have a series of Points and want to select a sub-set of Points from that series.

# Basics

Let us discuss the basics of Query Expression:

Query Expression works on linear lists. Query expressions have two required parts:

1. Definition of variable

2. Identification of the source list from which the variable is selected.

In a Query Expression, '**from**' is the keyword that starts the Query Expression, then we need to add the variable (here we have used 'point' as the variable). After that we need to use the '**in**' keyword which will specify the source list, then we will be using the source list** **(here Point1 is the source list)

# Steps to Accomplish

**Method 1:**

If we need to select all the points in a point series, we can do it by using the expression below:

**from point in Point1 **

This means the selected points will be all the points in the point list.

To identify the sub-set of points, we will create vertical lines on those selected Points. Here Point1 is the set of points & it begins from left to right. (The same process will also be followed in the below mentioned methods)

**Method 2:**

If we need to select the first few points in a point series, we can do it by using the expression below:

** from point in Point1 take 5 **

That means it will take the first 5 points (Point1[0] to point1[4]). You can select any number of points in the point list. Here we are selecting 5 points.

**Method 3 :**

If we need to select specific points in a point series, we can do it by using the expression below:

**from point in Point1 skip 5**

This means it will skip the first 5 points and take the rest of the points in the list.

**Method 4 :**

If we need to select the points in the middle of a point series, we can do it by the expression below:

** from point in Point1 take 8 skip 5 **

That means it will take the points from 5 to 7 (Point1[5] to point1[7]). In this expression the starting of the selection of the point will be of point number 7, as 8 is an argument to the list method and as we have commanded to skip 5 points therefore point 5, point 6 and point 7 will be selected.

Please go through the sample file, communities.bentley.com/.../Selection-of-points-based-on-Query-Expressions.gct

# Note:

For OBD Update 7 and later versions the **First** has been changed to **Take **and **Last** has been changed to **TakeLast**. The functionality is similar as the previous functions, only the name of the functions have been changed.