Open topic with navigation

# write_idx

The `write_idx` function writes a document to disk as an IDX file. If you specify the name of an existing IDX file, the document is appended to the file.

## Syntax

    write_idx( doc, outputFilename [, archiveDirectory [, maxSizeKBs
       [, shouldUseSections]]] )

## Arguments

Argument | Description
--- | ---
`doc` | (LuaDocument) The document to be written to an IDX file.
`outputFilename` | (string) The filename of the output IDX file.
`archiveDirectory` | (string) The folder to which IDX files are archived when they reach the maximum size. The default folder is the current directory (`.`)
`maxSizeKBs` | (integer) The maximum size of an IDX file (in kilobytes) before it is archived. To specify no maximum size, use the value `-1`. This is the default setting.
`shouldUseSections` | (string) Specifies whether to divide the document into sections. `True`. Divide the document into sections. `False`. Do not divide the document into sections. This is the default setting. `Empty string`. Use the default settings for sectioning.

## Returns

Boolean. Returns `true` if the IDX file was created successfully, and `false` otherwise.

## Examples

    function handler(document)
       return write_idx(document, "my_new_idx_file")
    end

    function handler(document)
       local was_idx_written = write_idx(document,
              "idx_files/main_file.idx", "archive_idx_files", 1024, "true")
       return was_idx_written
    end

© Copyright 2018 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm