# EssDeleteVariable

Description

EssDeleteVariable() deletes a substitution variable.

Syntax

    ESS_FUNC_M EssDeleteVariable (hCtx, pVariable);

ESS_HCTX_T | hCtx
ESS_PVARIABLE_T | pVariable

Parameters

hCtx | Context handle to the Essbase API.
pVariable | The pointer to the structure containing the description of the substitution variable being deleted.

Return Value

If successful, returns zero.

Example

    /*
    ** ESS_DeleteVariable() deletes a substitution variable using
    ** the API EssDeleteVariable.
    */
    ESS_FUNC_M
    ESS_DeleteVariable (ESS_HCTX_T hCtx)
    {
       ESS_FUNC_M       sts = ESS_STS_NOERR;
       ESS_VARIABLE_T  Variable;
       ESS_PVARIABLE_T pVariables;
       ESS_ULONG_T     ulCount, i;
       printf("\n ******************************************");
       printf("\n **** An example of using EssDeleteVariable");
       printf("\n ******************************************");

       strcpy(Variable.VarName, "QuarterName");
       strcpy(Variable.Server,  "Local");
       strcpy(Variable.AppName, "Sample");
       strcpy(Variable.DbName,  "Basic");
       sts = EssDeleteVariable(hCtx, &Variable);
       if (sts == ESS_STS_NOERR)
         printf("\n Variable 'QuarterName' at the Server/App/Db level is deleted");
       if (sts == ESS_STS_NOERR)
       {
         strcpy(Variable.VarName, "MarketName");
         strcpy(Variable.Server,  "Local");
         strcpy(Variable.AppName, "Sample");
         strcpy(Variable.DbName,  "");
         sts = EssDeleteVariable(hCtx, &Variable);
         if (sts == ESS_STS_NOERR)
             printf("\n Variable 'MarketName' at the Server/App level is deleted");
       }

       if (sts == ESS_STS_NOERR)
       {
         strcpy(Variable.VarName, "MarketName");
         strcpy(Variable.Server,  "Local");
         strcpy(Variable.AppName, "");
         strcpy(Variable.DbName,  "");
         sts = EssDeleteVariable(hCtx, &Variable);
         if (sts == ESS_STS_NOERR)
             printf("\n Variable 'MarketName' at the Server level is deleted");
       }

       /*********************************************************/
       /* List the variables at the level of the Server/App/Db- */
       /* We should not have any                                */
       /*********************************************************/
       if (sts == ESS_STS_NOERR)
       {
         strcpy(Variable.Server,  "local");
         strcpy(Variable.AppName, "Sample");
         strcpy(Variable.DbName,  "Basic");
         sts = EssListVariables(hCtx, &Variable, &ulCount, &pVariables);
         if (sts == ESS_STS_NOERR)
         {
            printf("\n--- Number of Substitution Variables at the Server, App and Db
              level is: %ld\n", ulCount);
            for (i = 0; i < ulCount; i++)
            {
               printf("Variable name    : %s\n",   pVariables[i].VarName);
               printf("Server name      : %s\n",   pVariables[i].Server);
               printf("Application name : %s\n",   pVariables[i].AppName);
               printf("Database name    : %s\n",   pVariables[i].DbName);
               printf("Variable value   : %s\n\n", pVariables[i].VarValue);
            }
         }
       }
       /*********************************************************/
       /* List the variables - at the level of the App          */
       /*********************************************************/

       if (sts == ESS_STS_NOERR)
       {
         strcpy(Variable.Server,  "local");
         strcpy(Variable.AppName, "Sample");
         strcpy(Variable.DbName,  "");
         sts = EssListVariables(hCtx, &Variable, &ulCount, &pVariables);
         if (sts == ESS_STS_NOERR)
         {
            printf("\n--- Number of Substitution Variables at the Server and App
              level is: %ld\n", ulCount);
            for (i = 0; i < ulCount; i++)
            {
               printf("Variable name    : %s\n",   pVariables[i].VarName);
               printf("Server name      : %s\n",   pVariables[i].Server);
               printf("Application name : %s\n",   pVariables[i].AppName);
               printf("Database name    : %s\n",   pVariables[i].DbName);
               printf("Variable value   : %s\n\n", pVariables[i].VarValue);
            }
         }
       }
       /*********************************************************/
       /* List variables at the server level                    */
       /*********************************************************/
       if (sts == ESS_STS_NOERR)
       {
         strcpy(Variable.Server,  "local");
         strcpy(Variable.AppName, "");
         strcpy(Variable.DbName,  "");
         sts = EssListVariables(hCtx, &Variable, &ulCount, &pVariables);
         if (sts == ESS_STS_NOERR)
         {
            printf("\n--- Number of Substitution Variables at the Server level is:
              %ld\n", ulCount);
            for (i = 0; i < ulCount; i++)
            {
               printf("Variable name    : %s\n",   pVariables[i].VarName);
               printf("Server name      : %s\n",   pVariables[i].Server);
               printf("Application name : %s\n",   pVariables[i].AppName);
               printf("Database name    : %s\n",   pVariables[i].DbName);
               printf("Variable value   : %s\n\n", pVariables[i].VarValue);
            }
         }
       }
       if (sts == ESS_STS_NOERR)
          printf("\n --> No Errors in EssDeleteVariable\n\n\n");
       else
          printf("\n --> Error in EssDeleteVariable number: %d\n\n\n", sts);
       return (sts);
    } /* end ESS_DeleteVariable */

Output

     ******************************************
     **** An example of using EssDeleteVariable
     ******************************************
     Variable 'QuarterName' at the Server/App/Db level is deleted
     Variable 'MarketName' at the Server/App level is deleted
     Variable 'MarketName' at the Server level is deleted
    --- Number of Substitution Variables at the Server, App and Db level is: 0
    --- Number of Substitution Variables at the Server and App level is: 0
    --- Number of Substitution Variables at the Server level is: 0
     --> No Errors in EssDeleteVariable

See Also

ESS_VARIABLE_T
EssCreateVariable()
EssGetVariable()
EssListVariables()