# Defining a primary key

A **primary key (PK)** is a field which contains keys unique for each record. When you add input fields to your Qommentary Form, you will need to designate one field as the primary key.

There are two (2) types of primary keys:

<table><thead><tr><th width="150">Type</th><th>Description</th><th>Supported fields</th></tr></thead><tbody><tr><td>Input</td><td>Primary key is determined by a field present in the form</td><td>Text, Number and Dropdown</td></tr><tr><td>Autonumeric</td><td>Primary key is generated by the database</td><td>n/a</td></tr></tbody></table>

### Defining an Input PK

To setup a connection with an *Input* primary key type, please follow these steps:

1\. Edit the extension's properties

2\. Expand the *Data Connections* section

3\. Set the *Primary key Type* to **Input field**

<div align="left"><img src="/files/yhlfZnJLgDOmMUPUyS2o" alt=""></div>

4\. Expand *Input fields* and select the input field to nominate as primary key

5\. Click on the switch control to select input field as **Primary key**

![](/files/yedH50NnDVBWZyR6IHTk)

### Defining an **Autonumeric** PK

To setup a connection with an *Autonumeric* primary key type, please follow these steps:

1\. Edit the extension's properties

2\. Expand the *Data Connections* section

3\. Set the *Primary key Type* to **Autonumeric**

![](/files/56L9mZ9COyMwYCGgppPX)

6\. Enter *Key column name* for the selected connection

![](/files/sJTzgWOBUogMDkGz9FOS)&#x20;

###


---

# 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://knowledgebase.qommentary.com/qommentary-form/defining-a-primary-key.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.
