# EssCreateFilter

Description

EssCreateFilter() creates a new filter and starts setting its contents.

Syntax

    ESS_FUNC_M  EssCreateFilter (hCtx, AppName, DbName, FilterName, Active, Access);

ESS_HCTX_T | hCtx
ESS_STR_T | AppName
ESS_STR_T | DbName
ESS_STR_T | FilterName
ESS_BOOL_T | Active
ESS_ACCESS_T | Access

Parameters

hCtx | Essbase API context handle
AppName | Application name
DbName | Database name
FilterName | Filter name, up to 30 characters long
Active | Filter active flag. If TRUE, the filter is set active, otherwise it is set inactive.
Access | The default filter access level

Return Value

None.

Notes

- If the filter does not already exist, it will be created by this call.
- If the filter already exists, an error message is returned.
- This call must be followed by successive calls to EssSetFilterRow() to set all the rows for the filter.

Access

This function requires the caller to have database designer permission (ESS_PRIV_DBDESIGN) for the specified database.

Example

    ESS_FUNC_M
    ESS_CreateFilter (ESS_HCTX_T  hCtx)
    {
       ESS_FUNC_M       sts = ESS_STS_NOERR;
       ESS_STR_T       AppName;
       ESS_STR_T       DbName;
       ESS_STR_T       FilterName;
       ESS_BOOL_T      Active;
       ESS_ACCESS_T    Access, AccessAry[3];
       ESS_STR_T       RowString[3];
       ESS_USHORT_T    ind;

       AppName    = "Sample";
       DbName     = "Basic";
       FilterName = "NewFilter";
       Active     = ESS_TRUE;

        /***** Create Filter *****/
        sts = EssCreateFilter(hCtx, AppName, DbName,
              FilterName, Active, Access);
       if(!sts)
       {
          RowString[0] = "@IDESCENDANTS(Scenario)";
          RowString[1] = "@IDESCENDANTS(Product)";
          RowString[2] = "Qtr1, @IDESCENDANTS(\"Colas\")";

          AccessAry[0] = ESS_ACCESS_READ;
          AccessAry[1] = ESS_ACCESS_NONE;
          AccessAry[2] = ESS_ACCESS_WRITE;
          /***** Set Filter Rows *****/

          for(ind = 0; ind < 3; ind++)
          {
             sts = EssSetFilterRow(hCtx, RowString[ind],
                        AccessAry[ind]);
             if(sts)
                printf("Cannot set Filter row %s\r\n",
                        RowString[ind]);
          }
             sts = EssSetFilterRow(hCtx,
                   "",ESS_ACCESS_NONE);
       }
       return (sts);
    }

See Also

EssGetFilter()
EssListFilters()
EssSetFilterRow()
EssSetFilter()