Get Data

Command line:
tlapi ‑cGETDATA [‑psPhase] [‑l] ‑mnMark ‑osOutFile sPart
Library call:
nStatus = TLgetdata (sPart, sPhase, nLock, nMark, sOutFile)
Scripting call:
sOutFile = GetData (sLocation, bLock)

Function

Create a file containing a copy of the current data in a partition. The data can be from the current published phase (if this exists), or from the update phase.

Arguments

sPart

The path of the partition from which data is to be extracted.

sOutFile

The full pathname of the file to receive the partition data.

sPhase

The partition phase from which to take the data. One of INITIAL, PUBLISH, UPDATE or CURRENT. Defaults to PUBLISH, so for a non-looseleaf job it is usual to select INITIAL.

The scripting call uses the Phase property to determine the phase to use.

nLock

If non-zero, an edit lock is placed on the partition when the data is retrieved. Use this facility if your intention is to change the data and replace it. The partition must be unlocked with the Unlock API call.

In the command line version, use the ‑l flag to request an edit lock.

bLock

This applies to the scripting call only. If this is true, an edit lock is placed on the partition when the data is retrieved. The edit lock is removed by a call to PutData if the AutoEditUnlock property is set to true, or by an explicit call to the UnlockPartition method.

nMark

Controls the insertion of boundary markers (see below) as follows:

  • 0 = use the partition show leaf boundary markers property setting to determine whether markers are inserted.

  • 1 = always insert boundary markers.

  • 2 = never insert boundary markers.

sLocation

This applies to the scripting interface only. This determines where the output file is created:

  • If null or the empty string, the file is created in a directory designated for temporary files.

  • If it is the path to an existing directory, the file is created in this directory.

  • Otherwise, the file is created using sLocation as a path. Any existing file with this path will be overwritten.

When a file name is generated, it will have extension “.xml”.

For additional command line arguments see “Common Flag Arguments”.

Scripting Call Return

The return value is a string containing the path to the data file. This is always an absolute path. It is also available as the value of the OutputFile property.

An empty string is returned if any problems occur when creating the output file.

Notes

f the selected phase is INITIAL, the returned document file is a copy of the original mainwork document.

For a looseleaf partition, if the selected phase is either UPDATE or PUBLISH, the returned document file may contain published boundary markers. A boundary marker is a TopLeaf processing instruction that identifies a published leaf, page or line boundary within a looseleaf partition document.

Examples

Command line:

tlapi ‑cGETDATA ‑pUPDATE ‑oC:\data.xml manuals/topix/vol1

Library call:

status = TLgetdata("manuals/topix/vol1", "UPDATE", 0L, 0L, "C:\\data.xml");

Scripting call:

file = topleaf.GetData("C:\\Temp", false);