Worksheet::RunFilter

 

Version

Minimum Origin Version Required: Origin 2016 SR0

Description

Run enable data filters in the worksheet

Syntax

int RunFilter( int nAction = QUERY_FILTER_ACT_HIDE_NOT_MATCHED, int nRowBegin = -1, int nRowEnd = -1, bool bUndo = false, DWORD dwCntrl = 0, ColumnUpdateFilterCondition * pExcludeColCondition = NULL )

Parameters

nAction
[input] hide/select/mask the worksheet rows. See QueryFilterActionTypes in oc_const.h
nRowBegin
[input] the begin of the filter range
nRowEnd
[input] the end of the filter range
bUndo
[input] whether the action should be undoable.
dwCntrl
pExcludeColCondition

Return

0 if success

Examples

EX1

void Column_RunFilter_ex1()
{
    Worksheet wks;
    if( wks.Create("origin") )
    {
        Dataset ds(wks, 0);
        ds.Data(1, 10);
    }
    
    CommandColumnFilterData mydata;
    mydata.lpcszCommand = "col <= 2 or col > 6";
    
    Column col(wks, 0);
    col.SetFilter((int)COLUMN_FILTER_TYPE_COMMAND, (LPVOID)&mydata);
    col.SetFilterThisCol("col");
    
    wks.RunFilter(QUERY_FILTER_ACT_HIDE_NOT_MATCHED, -1, -1, true);
}

EX2

void Column_RunFilter_ex2()
{
    Worksheet wks;
    if( wks.Create("origin") )
    {
        Dataset ds(wks, 0);
        ds.Uniform(30);
    }
    
    DatasetFuncColumnFilterData mydata;
    mydata.lpcszFunc = "top";
    mydata.lpcszArgs = "10,1";//10,0: top 10; 10,1: top 10%
    
    Column col(wks, 0);
    col.SetFilter((int)COLUMN_FILTER_TYPE_DATASET_FUNC, (LPVOID)&mydata);
    
    wks.RunFilter(QUERY_FILTER_ACT_SELECT_MATCHED, -1, -1, true);
}

Remark

See Also

Column::SetFilter, Column::GetFilter, Column::ResetFilter

header to Included

origin.h