Share this page

# lrvtc.ensureIndex

Creates an index on a column.

Global Functions

## Syntax

    lrvtc.ensureIndex ( columnName );

## Arguments

name | Comments
--- | ---
columnName | The name of the column to index.

lrvtc.ensureIndex creates a column index. If a column is not indexed, the time required to execute a lrvtc.sendIfUnique call increases with the number of rows. If the column is indexed, the time for 'send if unique' operations is constant. For large databases, we recommend that you index columns you want to perform 'send if unique' operations.

A column is locked while an index is being built on it. Any function calls that change the column are queued until the index build completes.

If the index exists, this function has no effect.

## Return Values

Returns zero on success or one of the Error Codes.

## Parameterization

All string input arguments can be passed using standard parameterization.

## Example

    var rc = 0;

    rc = lrvtc.createColumn("Name");
    if(rc) {lr.errorMessage("Create column failed.");}

    rc = lrvtc.ensureIndex("Name");
    if(rc) {lr.errorMessage("Index operation failed.");}

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: