cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
Jim_G_Pappas
Level II

Data Filter only by columns that are of type 'character'

col_name_list_character=dt << Get Column Names("Character");

//  would like (if possible) to only filter by columns of type character. 
// Same as filtering by col_name_list_character above
//
Button Box( " Activate Filter ", dfilter = dt << data filter( Mode( Show( 1 ), Include( 1 ) ), add filter() ) ), 
//
// right now, the filter box has all columns (numeric and character)

I am having a hard time figuring out how to create a data filter within my application that ONLY filters by columns of type 'character'.  A small portion of my code is attached.   Seems like this one should be easy, but I'm obviously missing something.  Any help is appreciated!  

Jim Pappas
1 ACCEPTED SOLUTION

Accepted Solutions
Phil_Brown
Super User (Alumni)

Re: Data Filter only by columns that are of type 'character'

Hi @Jim_G_Pappas

 

 

Try this:

 

Button Box( " Activate Filter ",
 	dfilter = dt << data filter( Mode( Show( 1 ), Include( 1 ) ), add filter() );
 	colObjList = {};
	For( i=1, i<=NItems(col_name_list_chacter), i++,
  		InsertInto(colObjList, Column(col_name_list_chacter[i]) );
 	);
 	Eval(EvalExpr( dfilter << columns( Expr(colObjList) ) ) );
       dfilter << Display( Single Category Display );

);

Note the "global" application of the option as you correctly described is achieved by apply the << Display( Single Category Display ) to the Data Filter Object, rather than each column

PDB

View solution in original post

5 REPLIES 5
Phil_Brown
Super User (Alumni)

Re: Data Filter only by columns that are of type 'character'

@Jim_G_Pappas

Try adding:

Button Box( " Activate Filter ",
  dfilter = dt << data filter( Mode( Show( 1 ), Include( 1 ) ), add filter() );
  colObjList = {};
For( i=1, i<=NItems(col_name_list_chacter), i++,
   InsertInto(colObjList, Column(col_name_list_chacter[i]) );
  );
  Eval(EvalExpr( dfilter << columns( Expr(colObjList) ) ) );
);

 

PDB
Jim_G_Pappas
Level II

Re: Data Filter only by columns that are of type 'character'

That works great - I really appreciate the response!

The only issue is that all the options / levels are showing for each column.  So the filter list goes way off the bottom of the page.  I can manually solve this AFTER the filter shows up on the screen (Display Options >  Single Category Display) but am having difficulty adding this to the code.   I can do this for each column (ex.  Display( :Operator, Single Category Display ) but don't know how to "globally" do this on each column since the columns change from dataset to dataset.   

 

Any advice on that one?

Jim Pappas
Phil_Brown
Super User (Alumni)

Re: Data Filter only by columns that are of type 'character'

Hi @Jim_G_Pappas

 

 

Try this:

 

Button Box( " Activate Filter ",
 	dfilter = dt << data filter( Mode( Show( 1 ), Include( 1 ) ), add filter() );
 	colObjList = {};
	For( i=1, i<=NItems(col_name_list_chacter), i++,
  		InsertInto(colObjList, Column(col_name_list_chacter[i]) );
 	);
 	Eval(EvalExpr( dfilter << columns( Expr(colObjList) ) ) );
       dfilter << Display( Single Category Display );

);

Note the "global" application of the option as you correctly described is achieved by apply the << Display( Single Category Display ) to the Data Filter Object, rather than each column

PDB
Jim_G_Pappas
Level II

Re: Data Filter only by columns that are of type 'character'

That works great!   Thank you so much. 

Jim Pappas
Phil_Brown
Super User (Alumni)

Re: Data Filter only by columns that are of type 'character'

You're very welcome!
PDB