> For the complete documentation index, see [llms.txt](https://aeudoc.gitbook.io/developer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aeudoc.gitbook.io/developer/backend/data-repository/read-columns.md).

# Read Columns

## Syntax

```
GetFields<TResult>(columns, filter, maxRows);
```

## Arguments

<table data-header-hidden><thead><tr><th width="181">Argument</th><th width="189">Data Type</th><th width="290">Description</th><th>Default Value</th></tr></thead><tbody><tr><td><em>columns</em></td><td>Expression&#x3C;Func&#x3C;T, TResult>></td><td><p>Criteria by which the records of the repository should be filtered. </p><p>This parameter must not be empty. </p></td><td></td></tr><tr><td><em>filter</em></td><td>Expression&#x3C;Func&#x3C;T, bool>></td><td><p>Criteria by which the records of the repository should be filtered. </p><p>This parameter must not be empty. </p></td><td>null </td></tr><tr><td><p><em>orderBy</em></p><p> </p></td><td>Func&#x3C;IQueryable, IOrderedQueryable></td><td><p>Order in which the filtered records should be listed. </p><p>This parameter is optional.</p></td><td>null </td></tr><tr><td><em>includeProperties</em></td><td>string</td><td><p>Navigation properties (recognized by the key word "virtual") that should be included.</p><p>This parameter is optional.</p></td><td>""</td></tr><tr><td><em>maxRows</em></td><td>int?</td><td><p>Maximal number of records that should be filtered. </p><p>This parameter is optional.</p></td><td>null</td></tr></tbody></table>

## Description

Gets all the columns that are specified in the parameter *columns* from all the records of a repository that fulfill the criteria specified in the parameter *filter*.

If *orderBy* is not null, it first orders the records according to the attributes specified in the parameter *orderBy* before getting the columns from the newly ordered list.&#x20;

If *includeProperties* is not null, it additionally loads the navigation properties that are specified in the parameter *includeProperties*. Navigation properties are "virtual" properties of the repository, i.e. they are not real properties and are accessed by navigating to another object. They would not get loaded unless specified in this parameter.

If maxR*ows* is not 0, it makes sure that the number of filtered records does not exceed the specified number.

## Example

### Example 1: Reading only one specific column

The following program illustrates the function call with only one specified column:

```
var orderColumns = repo.GetFields(x => x.ProductID, 
                                  c => c.ProductID == "ADAM-567-BTO");
```

Function will load the column "ProductID" from the records of the repository that have "ADAM-567-BTO" as Production ID and store the result into the variable "orderColumns".

### Example 2: Reading multiple columns

The following program illustrates the function call with three specified columns:

```
var orderColumns = repo.GetFields(x => new { x.ProductID, 
                                             x.ID, 
                                             x.Quantity }, 
                                  c => c.ProductID == "ADAM-567-BTO");
```

Function will load the columns "ProductID", "ID" and "Quantity" from the records of the repository that have "ADAM-567-BTO" as Production ID and store the result into the variable "orderColumns".

### Example 3: Reading multiple columns with custom names

The following program illustrates the function call with three specified columns where two of them are given custom names:

```
var orderColumns = repo.GetFields(x => new { ProductName = x.ProductID, 
                                             OrderNumber = x.ID, 
                                             x.Quantity }, 
                                  c => c.ProductID == "ADAM-567-BTO");
```

Function will load the columns "ProductID", "ID" and "Quantity" from the records of the repository that have "ADAM-567-BTO" as Production ID and store the result into the variable "orderColumns", renaming the item "ProductionID" into "ProductName" and "ID" into "OrderNumber". The item "Quantity" maintains its name from the repository.

### Example 4: Reading multiple columns and multiple filter criteria

```
var orderColumns = repo.GetFields(x => new { x.ProductID, 
                                             x.ID }, 
                                  c => c.ProductID == "ADAM-567-BTO"
                                    && c.Quantity > 10 
                                    && c.IsUrgent == true);
```

Function will load the columns "ProductID" and "ID" from the records of the repository that have "ADAM-567-BTO" as Production ID, have a Quantity of more than 10 and are Urgent, and store the result into the variable "orderColumns".

### Example 5: Reading multiple columns with order + maximum limit

```
var orderColumns = repo.GetFields(x => new { x.ProductID, 
                                             x.ID }, 
                                  c => c.ProductID == "ADAM-567-BTO",
                                  o => o.OrderBy(t => t.Timestamp),  
                                  "",
                                  100);
```

Function will order the records by their Timestamp attribute, load the columns "ProductID" and "ID" from a maximum of 100 records of the ordered repository that have "ADAM-567-BTO" as Production ID and store the result into the variable "orderColumns".

### Example 6: Reading multiple columns with order + maximum limit and including a virtual property

The following program illustrates the function call with multiple criteria, specified order, maximum limit and external property:

```
var orderList = repo.Get(x => x.ProductID == "ADAM-567-BTO" 
                           && c.Quantity > 10, 
                         o => o.OrderBy(c => c.Timestamp), 
                         "SapOrder",
                         100);
```

Function will order the records by their Timestamp attribute, load the columns "ProductID" and "ID" from a maximum of 100 records of the ordered repository that have "ADAM-567-BTO" as Production ID and a Quantity of more than 10, include the virtual property "SapOrder" (a navigation property of "Production Order") and store the result into the variable "orderList".


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://aeudoc.gitbook.io/developer/backend/data-repository/read-columns.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.
