Page 1 of 1

Initial Filter and Warning when displaying as a child-dv

Posted: 2014-09-19 11:04
by JEngels
Hi,
what about following problem:
1. Initial filter set in hooks

function publikationen_init(&$options, $memberInfo, &$args){
if(!$_POST['FilterField'][1] && !$_GET['FilterField'][1]){
addFilter(1, 'and', 12, 'isEmpty');
}
return TRUE;
}

Works fine when calling table "publikationen"

2. Records of table "publikationen" are child records.
When request a child from another mother-table-dv following warning appears (but only in popup-modus, calling the childs by a link to the detail records seems to be okay):
"Warning: Missing argument 5 for addFilter(), called in /volume1/web/sites/AS_MediaCollector/hooks/publikationen.php on line 10 and defined in /volume1/web/sites/AS_MediaCollector/incCommon.php on line 412"
But nevertheless child-dv is correct.

What to do?

Thanks in advance
Koepi

Re: Initial Filter and Warning when displaying as a child-dv

Posted: 2014-09-22 13:25
by udayvatturi
Hi,

Basically filter should have 5 parameters

Eg:

Code: Select all

addFilter(1, 'and', 7, '<=>', 'New');
1. The filter index.
2. How to combine with previous filter. Accepted values: 'and', 'or'.
3. The field index. The first field in a table has an index of 1, the second 2, ... etc.
4 .The filter type (operator). Accepted values (case-sensitive):
'<=>', '!=', '>', '>=', '<', '<=', 'like', 'not like', 'isEmpty', 'isNotEmpty'
5. The filtered value.

It will definitely throw you an error if you use four parameters

I think may be the control is not going to the "If" condition in your code , so you are not getting any error in normal page view..

Code: Select all

function publikationen_init(&$options, $memberInfo, &$args){
if(!$_POST['FilterField'][1] && !$_GET['FilterField'][1]){
addFilter(1, 'and', 12, 'isEmpty');
}	
return TRUE;
}

Re: Initial Filter and Warning when displaying as a child-dv

Posted: 2014-09-22 13:45
by JEngels
Thanks Uday.
But what about the fifth parameter (filtered value) when filter type is 'isEmpty' or 'isNotEmpty' ?
Please excuse me even not knowing the basics...

Koepi

Re: Initial Filter and Warning when displaying as a child-dv

Posted: 2014-09-22 15:18
by udayvatturi
If you want to search for an Empty String you can try the following
addFilter(1, 'and', 12, =,'');