# EssOtlRestructure

Description

EssOtlRestructure() restructures an outline on the server. This is an asynchronous call.

Syntax

    ESS_FUNC_M EssOtlRestructure (hCtx, usRestructType);

ESS_HCTX_T | hCtx
ESS_USHORT_T | usRestructType

Parameters

hCtx | Server login context handle. This must be the server on which the outline was saved using EssOtlWriteOutline().
usRestructType | Type of restructuring to do. This can be one of the following values: ESS_DOR_ALLDATA ESS_DOR_INDATA ESS_DOR_LOWDATA ESS_DOR_NODATA ESS_DOR_FORCE_ALLDATA

Return Value

Returns 0 if successful; otherwise returns OTLAPI_BAD_RESTRUCTTYPE structure.

Notes

- You must save the outline using EssOtlWriteOutline() before calling this function.
- This call is valid only for outlines saved to the server.
- This call is asynchronous. You should call EssGetProcessState() after making this call until EssGetProcessState() returns a status indicating the restructure operation is complete.
- In order for data to be properly restructured (saving data), the outline must have been opened using EssOtlOpenOutline() with the fKeepTrans flag set to ESS_TRUE.

Access

This function requires you to have the appropriate level of access to the specified application and/or database to contain the outline object. To restructure the outline object, you must have Application Designer or Database Designer privilege (ESS_PRIV_APPDESIGN or ESS_PRIV_DBDESIGN) for the specified application or database containing the outline.

Example

    #include <essapi.h>
    #include <essotl.h>

    ESS_STS_T          sts = 0;
    ESS_HCTX_T         hCtx;
    ESS_HOUTLINE_T     hOutline;
    ESS_OBJDEF_T       Object;
    ESS_APPNAME_T      szAppName;
    ESS_DBNAME_T       szDbName;
    ESS_OBJNAME_T      szFileName;

    memset(&Object, '\0', sizeof(Object));
    Object.hCtx = hCtx;
    Object.ObjType = ESS_OBJTYPE_OUTLINE;
    strcpy(szAppName, "Sample");
    strcpy(szDbName, "Basic");
    strcpy(szFileName, "Basic");
    Object.AppName = szAppName;
    Object.DbName = szDbName;
    Object.FileName = szFileName;

    sts = EssOtlOpenOutline(hCtx, &Object, ESS_TRUE,
         ESS_TRUE, &hOutline);

    /* body of code */
    /* write outline to server using */
    /* EssOtlWriteOutline()          */

    if (!sts)
    {
       sts = EssOtlRestructure(hCtx, ESS_DOR_ALLDATA);
    }

    /* need to call EssGetProcessState() */
    /* to check for completion before proceeding */

See Also

EssOtlOpenOutline()
EssOtlNewOutline()
EssOtlWriteOutline()
EssOtlVerifyOutline()
EssOtlCloseOutline()