Page 1 of 1

Filter before

Posted: 2014-06-23 19:13
by pasbonte
hello
how to filter a table before it is displayed?
being French, I can not begin to understand.
I have a code_structure field.
this field is blank with some recordings.
how to filter to display only non-empty?

Re: Filter before

Posted: 2014-06-28 19:47
by pasbonte
no response ?
merci !

Re: Filter before

Posted: 2014-06-29 09:39
by pasbonte
help !
please :D

Re: Filter before

Posted: 2014-06-30 00:37
by wplim
Hi pasbonte,

Have you look into this tutorial:
http://bigprof.com/appgini/tips-and-tut ... ult-filter

Your code in the hook folder yourtablename.php should look something like below:

Code: Select all

function yourtablename_init(&$options, $memberInfo, &$args){
	/* Apply a default filter only if no filter is already applied by the user */
	if(!$_POST['FilterField'][1] && !$_GET['FilterField'][1]){
		/*
			In the call below, we want to display records of the yourtablename
			table where the value of the code_structure field (assuming is the 7th field) field is not empty.
		*/
		addFilter(1, 'and', 7, 'isNotEmpty', '');
	}
	
	return TRUE;
}
**replace yourtablename with the actual table name.

Re: Filter before

Posted: 2014-11-21 09:50
by faariwasi
Thank you very much. This works great!