# EssImport

Description

EssImport() allows importing data from different sources to the Essbase server.

Syntax

    ESS_FUNC_M EssImport (hCtx, pRules, pData, ppMbrErr, pMbrUser, abortOnError);

ESS_HCTX_T | hCtx
ESS_POBJDEF_T | pRules
ESS_POBJDEF_T | pData
ESS_PPMBRERR_T | ppMbrErr
ESS_PMBRUSER_T | pMbrUser
ESS_USHORT_T | abortOnError

Parameters

hCtx | Essbase API context handle.
pRules | Pointer to the rules file object definition structure.
pData | Pointer to the data file object definition structure.
ppMbrErr | Pointer to linked list of errors contained in ESS_MBRERR_T. Possible errors are: ESS_MBRERR_BADDIM ESS_MBRERR_BADGEN ESS_MBRERR_UNKNOWN ESS_MBRERR_BADACCESS ESS_MBRERR_BADSYNTAX
pMbrUser | Pointer to the SQL user structure (if data source is a SQL database). A NULL SQL user structure indicates a non SQL data source.
AbortOnError | If TRUE import stops on the first error otherwise continues.

Return Value

Returns zero, if successful. Otherwise, returns an error code.

Notes

- For a non SQL source, if the AppName and DbName fields in ESS_OBJDEF_T structures for pRules and pData are empty strings, hCtx must be a local context handle, and the ESS_OBJDEF_T FileName field must contain the fully qualified path to the file.
- If a local object is used, EssCreateLocalContext() must be called first.
- The memory allocated for ppMbrErr must be freed using EssFreeMbrErr().

Access

This function requires the caller to have database design privilege for the specified database (ESS_PRIV_DBDESIGN).

Example

    ESS_FUNC_M
    ESS_Import(ESS_HCTX_T hCtx)
    {
       ESS_FUNC_M     sts = ESS_STS_NOERR;
       ESS_SHORT_T   isAbortOnError;
       ESS_OBJDEF_T  Rules;
       ESS_OBJDEF_T  Data;
       ESS_MBRUSER_T User;
       ESS_PMBRERR_T pMbrErr = NULL;

       Data.hCtx      = hCtx;
       Data.AppName   = "Olap";
       Data.DbName    = "Demo";
       Data.ObjType   = ESS_OBJTYPE_TEXT;
       Data.FileName  = "Actuals";

       Rules.hCtx     = hCtx;
       Rules.AppName  = "Olap";
       Rules.DbName   = "Demo";
       Rules.ObjType  = ESS_OBJTYPE_RULES;
       Rules.FileName = "Actmap";
       /**********************/
       /* Running conditions */
       /**********************/
       isAbortOnError = ESS_TRUE;

       sts = EssImport (hCtx, &Rules, &Data, &pMbrErr,
             NULL, isAbortOnError);
       if(pMbrErr)
          EssFreeMbrErr(hCtx, pMbrErr);
       /*******************************************************************/
       /*                                                                 */
       /* When a SQL data source is defined in the rules file, define     */
       /* the variables in the ESS_OBJDEF_T Data structure as follows:    */
       /*    Data.hCtx     = hCtx;                                        */
       /*    Data.AppName  = NULL;                                        */
       /*    Data.DbName   = NULL;                                        */
       /*    Data.ObjType  = ESS_OBJTYPE_NONE;                            */
       /*    Data.FileName = NULL;                                        */
       /*                                                                 */
       /* Also, provide strings for the variables in the ESS_MBRUSER_T    */
       /* User structure; for example:                                    */
       /*    User.User     = "Dbusernm";                                  */
       /*    User.Password = "Dbpasswd";                                  */
       /*                                                                 */
       /* Use a blank string for User and Password, if the SQL source     */
       /* does not require user and password information; for example:    */
       /*    User.User     = "";                                          */
       /*    User.Password = "";                                          */
       /*                                                                 */
       /* Also, define sts as follows:                                    */
       /*    sts =  EssImport (hCtx, &Rules, &Data, &pMbrErr,             */
       /*           &User, isAbortOnError);                               */
       /*                                                                 */
       /*******************************************************************/
    }

See Also

EssExport()
EssBuildDimension()
EssFreeMbrErr()