Hi
For a Filter in a select function i need some kind of logic.
Actually the (Hardcoded) Filter looks somethin like that:
Now i've got a select Form on this page where the user can select (dropdown not multiple): Home, Visitor, Both (Home and Visitor Matches)
based on this selection the Query should change to:
So at least form the 2nd Line i have to use a Switch - but if i try to call a switch-function ({fn:xyz}) or my following switch statement (which returns value as VAR / or not both tried) the Query failes --> Undefined column {fn:xyz} or {var:xyz} - is it generally possible to call a fn inside a Filter?
To bring it all together here is my Custom Code for the switch statement (which is also not working) - same error.
I don't want to create the whole read_data function three times just because of a single line...
thanks for your input
For a Filter in a select function i need some kind of logic.
Actually the (Hardcoded) Filter looks somethin like that:
year_id:{data:Data.year}This results in a fixed scenario where a table is displayed with the games where team 1 is either the visitor or home team.
AND
(
home:1
OR
visitor:1
)
Now i've got a select Form on this page where the user can select (dropdown not multiple): Home, Visitor, Both (Home and Visitor Matches)
based on this selection the Query should change to:
// Scenario Visitor:
year_id:{data:Data.year}
AND visitor=1
// Scenario Home:
year_id:{data:Data.year}
AND home=1
So at least form the 2nd Line i have to use a Switch - but if i try to call a switch-function ({fn:xyz}) or my following switch statement (which returns value as VAR / or not both tried) the Query failes --> Undefined column {fn:xyz} or {var:xyz} - is it generally possible to call a fn inside a Filter?
To bring it all together here is my Custom Code for the switch statement (which is also not working) - same error.
switch({data:Data.location}){
case 'home':
$query_string = ' AND home:{data:Data.team}';
break;
case 'visitor':
$query_string = ' AND visitor:{data:Data.team}';
break;
case 'both':
default:
$query_string = ' AND ( home:{data:Data.team} OR visitor:{data:Data.team} )';
}
return $query_string;

I don't want to create the whole read_data function three times just because of a single line...
thanks for your input