Creates or replaces a filter, and starts setting the contents of the filter.
Syntax
ESS_FUNC_M EssSetFilter (hCtx, AppName, DbName, FilterName, Active, Access);
Parameter | Data Type | Description |
---|---|---|
hCtx | ESS_HCTX_T | API context handle |
AppName | ESS_STR_T | Application name |
DbName | ESS_STR_T | Database name |
FilterName | ESS_STR_T | Filter name. See Filter Name Limits. |
Active | ESS_BOOL_T | Filter active flag. If TRUE, the filter is set active, otherwise it is set inactive. |
Access | ESS_ACCESS_T | The default filter access level |
Notes
If the filter does not already exist, it will first be created by this call.
This call must be followed by successive calls to EssSetFilterRow() to set all the rows for the filter.
To avoid overwriting a filter that already exists, use EssCreateFilter. EssCreateFilter creates only a uniquely named filter for a particular database, but will not overwrite an existing filter of the same name on the same database.
Return Value
None.
Access
This function requires the caller to have database Design privilege (ESS_PRIV_DBDESIGN) for the specified database.
Example
ESS_FUNC_M ESS_SetFilter (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; /***** Set Filter *****/ sts = EssSetFilter(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