---
name: "PX_add_primary_index"
section: "3"
platform: "linux"
package: "pxlib-dev"
version: "0.6.9-1+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/PX_add_primary_index"
---

# PX\_add\_primary\_index(3)

Assigns primary index to database file

## NAME

PX\_add\_primary\_index — Assigns primary index to database file

## SYNOPSIS

\#include \<paradox.h\>

int PX\_add\_primary\_index(pxdoc\_t \*pxdoc, pxdoc\_t \*pindexdoc)

## DESCRIPTION

Assigns an primary index to a database file. The primary index  must be loaded before as any Paradox file with [PX\_open\_fp(3)](/PX_open_fp/3.md) or  [PX\_open\_file(3)](/PX_open_file/3.md). **pxdoc** must be a Paradox database  file. In order to be able to use the index you will have to  call [PX\_read\_primary\_index(3)](/PX_read_primary_index/3.md) before accessing any record data.

## RETURN VALUE

Returns 0 on success and -1 on failure.

## SEE ALSO

[PX\_open\_fp(3)](/PX_open_fp/3.md), [PX\_open\_file(3)](/PX_open_file/3.md), [PX\_read\_primary\_index(3)](/PX_read_primary_index/3.md)

## AUTHOR

This manual page was written by Uwe Steinmann uwe@steinmann.cx.
