# EsbImport

Description

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

Syntax

    EsbImport (hCtx, pRules, pData, User, ErrName, isAbortOnError)

    ByVal hCtx           As Long
          pRules         As ESB_OBJDEF_T
          pData          As ESB_OBJDEF_T
          User           As ESB_MBRUSER_T
    ByVal ErrName        As String
    ByVal isAbortOnError As Integer

Parameters

hCtx | Essbase VB API context handle.
pRules | Pointer to the rules file object definition structure.
pData | Pointer to the data file object definition structure.
User | Pointer to the SQL user structure (if data source is a SQL database). A NULL SQL user structure indicates a non SQL data source.
ErrName | Name of the error output file to be created locally.
isAbortOnError | If TRUE import stops on the first error otherwise continues.

Return Value

None.

Notes

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

Access

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

Example

    Declare Function EsbImport Lib "ESBAPIW" (ByVal hCtx As Long, Rules As ESB_OBJDEF_T,
                                              Data As ESB_OBJDEF_T, User As ESB_MBRUSER_T,
                                              ByVal ErrName As String, ByVal AbortOnError As Integer)
                                              As Long
    Sub ESB_Import ()
       Dim sts          As Long
       Dim Rules        As ESB_OBJDEF_T
       Dim Data         As ESB_OBJDEF_T
       Dim User         As ESB_MBRUSER_T
       Dim ErrorName    As String
       Dim AbortOnError As Integer

       '*********************************
       ' Rules file resides at the server
       '*********************************
       Rules.hCtx     = hCtx
       Rules.Type     = ESB_OBJTYPE_RULES
       Rules.AppName  = "Demo"
       Rules.DbName   = "Basic"
       Rules.FileName = "Test"

       '********************************
       ' Data file resides at the server
       '********************************
       Data.hCtx      = hCtx
       Data.Type      = ESB_OBJTYPE_TEXT
       Data.AppName   = "Demo"
       Data.DbName    = "Basic"
       Data.FileName  = "Data"

       '********************************
       ' Specify file to redirect errors
       ' to if any
       '********************************
       ErrorName      = "IMPORT.ERR"

       '*************************
       ' Abort on the first error
       '*************************
       AbortOnError   = ESB_YES

       '*******
       ' Import
       '*******
       sts            = EsbImport (hCtx, Rules, Data, User, ErrorName, AbortOnError)

       '**********************************************************************
       '*
       '* When a SQL data source is defined in the rules file, define
       '* the variables in the ESB_OBJDEF_T Data structure as follows:
       '*    Data.hCtx     = hCtx
       '*    Data.AppName  = ""
       '*    Data.DbName   = ""
       '*    Data.ObjType  = ESB_OBJTYPE_NONE
       '*    Data.FileName = ""
       '*
       '* Also, provide strings for the variables in the ESB_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 = ""
       '*
       '* Call the function as follows:
       '*    sts           =  EsbImport (hCtx, Rules, Data, User, AbortOnError)
       '*
       '***********************************************************************

    End Sub

See Also

EsbExport()
EsbBuildDimension()