> 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/generate-row-id.md).

# Generate Row-Id

## Syntax

```
NewID(filter, len, prefix);
```

## Arguments

<table data-header-hidden><thead><tr><th width="181">Argument</th><th width="189">Data Type</th><th width="272">Description</th><th>Default Value</th></tr></thead><tbody><tr><td><em>filter</em></td><td>Expression&#x3C;Func&#x3C;T, string>></td><td><p>Column that contains the ID (Primary Key). </p><p>This parameter must not be empty.</p></td><td>null </td></tr><tr><td><em>len</em></td><td>int</td><td>Total number of characters ID should consist of (including <em>prefix</em>).</td><td>8</td></tr><tr><td><em>prefix</em></td><td>string</td><td></td><td>null</td></tr></tbody></table>

## Description

Generates a new ID value for the Primary Key column that is specified in the parameter *filter* by taking the ID value of the newest record in the repository and incrementing it by 1.&#x20;

If parameter *len* is specified, it will additionally add preceding zeroes until the number of digits/characters equals the number specified in the parameter *len*. If *len* is not specified, it will add preceding zeroes until the number of digits/characters equals 8.

If parameter *prefix* is specified, it will additionally add the inputted string in the beginning of the ID string. If *prefix* is not specified, it will not add anything else. The adding of the prefix happens before the insertion of additional zeroes, i.e. zeroes will be inserted between prefix and ID number until the total number of digits/characters (including the prefix) equals the specified length.

Usually used when creating a new record to insert into the repository (see "Insert Record").

## Example

The following program illustrates the function call:

```
var newId = repo.NewID(x => x.ID, 10, "EU");
```

The function will generate the new ID "EU00000120" (for the case that the newest record that is currently in the repository has the Primary Key Value "119") for the Primary Key column "ID" and store it in the variable "newId".


---

# 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/generate-row-id.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.
