# Table

### **Create Table: The empty table statement**

Sometimes it is necessary to create an empty table, containing only column names but no rows. This can be done by creating a Table Item with no rows in the workflow or using a FlowScript expression.

```fsharp
let emptyOrderList = table(orderNo, price, isConfirmed);
```

### **Converting a record to a table**

To convert a record into a table, use the multiplier (\*) unary operator.

```fsharp
let myTable = *myRecord;
let myOtherTable = *[a: 1, b: 2];
```

### **Insert row: The table concatenation (&) operator**

You can append a record to a table, or append a table to another table, using the `&` operator. The left hand side value (L) of the expression must be a table. The right hand side value (R) can either be a record or another table. R must contain all the columns/fields of L. Any fields/columns present in L but not R will be excluded from the output.

```fsharp
let newOrderList = orders & selectedOrder;
let allOrders = localOrders & centralOrders;
let orders = orders & [orderNo: orderNo, partNo: partNo, qty: qty];
```

### **Update row: The WITH Keyword**

WITH (described above) is also supported when working with tables. The example below updates the price column with new values. Note that all table mutation is non-destructive; in the example below, `items` is left unchanged while `newItems` contains the updated rows.

```fsharp
let newItems = items with [price: price * 1.03];
```

It is also possible to update only a subset of the rows in a table by appending a WHERE clause to the end of the WITH expression. A new table is returned with the mutation selectively applied to the rows that match the WHERE criteria.

```fsharp
let newItems = items with [price: price * 0.7] where qtyInStock > 100;
```

### **Delete rows: The EXCEPT Keyword**

If you need to remove a record from a table (creating a new table variable with the record excluded), use the *EXCEPT* keyword. The except keyword takes a table on the left hand side and a record on the right hand side. Each row of the table is examined and compared to the record. Rows in which every named cell also present in the record is equal to the record's cell are excluded from the output. This means that the *EXCEPT* keyword can remove more than one row; if two duplicate rows exist in the table, or if the record to remove has fewer fields than the table, more than one table row may match the record.

```fsharp
let otherOrdersEx1 = orders except selectedOrder;
let otherOrdersEx2 = orders except [orderNo: 'ABC1234'];
```

### **Delete rows: The EXCEPT WHERE Keyword**

Sometimes a filtering expression becomes more readable if the logic is inversed. The *EXCEPT WHERE* keyword does the opposite of the *WHERE* keyword: it returns a new table excluding (rather than including) the rows matching the right hand side condition.

```fsharp
let valuableOrders = orders except where price = 0;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.novacuraflow.com/development/flowscript/table.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
