# iql_functions_and_commands

### @param

The `@` character is used when declaring and using a variable.

The following example sets a variable to _"Example"_.

**Example**

```
set @textvar = 'Example'
```

The following **IQL** is an example from the [**Form designer**](../form_designer.md). The code is written as _behavior_ for a label. The code sets the caption of the label to _"Example"_.

**Example**

```
let @textvar = 'Example'
set :caption = @textvar
```

### Call

The `call` statement is used to execute a routine.

The statement can be used in:

| Forms: Behavior | Forms: Run on: click, change, init and select | Forms: Filters & iql-charts | Rules |
| --- | --- | --- | --- |
| x | ✓ | x | ✓ |

The following **IQL** is an example from the [**Form designer**](../form_designer.md). The code is written as a _Run on click_ routine for a button that has a detail as parent. The code saves the datasource of the detail when the button is clicked.

**Example**

```
call save()
```

### Where

The `where` clause is used to filter records.

> **Note:**
> 
> This clause is only used in configuration of Charts and Rules.

**Syntax**

```
Field name from Table name
where Condition
```

The function can be used in:

| Forms: Behavior | Forms: Run on: click, change, init and select | Forms: Filters & iql-charts | Rules |
| --- | --- | --- | --- |
| x | ✓ | x | x |

The following **IQL** is an example from the [**Form designer**](../form_designer.md). The code is written in a **IQL chart**, and it makes the **IQL chart** display the values of the fields _Full name_ and _Salary_ from all records in the _Employee_ table, where the _Full name_ value contains an _"a"_.

**Example**

```
"Full name", Salary from Employee
where "Full name" contains 'a'
```

### Group by

The `group by` clause is exclusive for configuration of _Charts_ and is used to arrange identical data into groups. It must be used in combination with aggregate [functions](#iql_functions.adoc) (count, sum, avg, min, max).

**Syntax**

```
Field name 1 ,Aggregate function(Field name 2) from Table name
group by Field name 1
```

The following **IQL** is an example from the [**Form designer**](../form_designer.md). The code is written in a **IQL chart**, and it makes the **IQL chart** display how many employees every department has from a table named _Employee_. The chart is grouped by _Department_.

**Example**

```
Department, count(Recordname) from Employee
group by Department
```

### Order by

The `order by` clause is exclusive for configuration of _Charts_ and is used to sort data by one column in ascending order by default. Add the keyword `desc` after to sort in descending order.

**Syntax**

```
Field name 1, Field name 2 from Table name
order by Field name
```

The following **IQL** is an example from the [**Form designer**](../form_designer.md). The code is written in a **IQL chart**, and it makes the **IQL chart** display how many employees every department has from a table named _Employee_. The chart is both grouped and sorted by _Department_.

**Example**

```
Department, count(Recordname) from Employee
group by Department
order by Department
```
