Filter-Dataset-in-Layer-Content
Last Update: 7/8/2018
When adding or removing data plots in Layer Contents dialog with dataset from multiple workbooks and worksheets , finding the favorite columns in the left panel would be a time-consuming task. Apart from using the built-in Available Data Drop-Down List , you can also add custom conditions in this list to do a more efficient filtering.
Suppose you want to filter columns with Short Name A (i.e. Col A) from all the columns of the same project in the Layer Contents left panel. To begin with adding custom conditions:
BOOL MySelection(OriginObject& obj, int nType) { switch ( nType ) { case QUERYRESULTS_FILTER_ELEMENTTYPE__FOLDER: return TRUE; case QUERYRESULTS_FILTER_ELEMENTTYPE__PAGE: { WorksheetPage wksPage; wksPage = (WorksheetPage)obj; return wksPage.IsValid(); } case QUERYRESULTS_FILTER_ELEMENTTYPE__LAYER: { Worksheet wks; wks = (Worksheet)obj; return wks.IsValid(); } case QUERYRESULTS_FILTER_ELEMENTTYPE__COLUMN: { Column col; col = (Column)obj; if ( !obj ) return FALSE; string strName; col.GetName(strName); return strName.Compare("A") == 0; } } return FALSE; }
[DatasetFilterFuncs] ShowColAOnly=MySelection|Column User Defined=Oubtn.ini
Note: You can add the created C file in the System Folder in Code Builder so your functions are always ready when Origin starts.
Since Origin 2018b, you can exclude some worksheets from showing in Plot Setup and Layer Contents dialogs by right clicking worksheet(s) tab and tag as Exclude from Plotting Dialogs.
Keywords:filter, layer content, column