I am using APPGINI 5.82 and applying a default filter to ALL tables using the tablename_init hook file. I incorporated a session variable (defined after a successful login) in the filter and it works just fine (shown):
addFilter(1,'and',2,'equal-to',$_SESSION["COMPANY"]);
I then tried a similar approach for the advanced query box in a Department table lookup field, modifying the default query by adding the condition:
WHERE `department`.`Company` = $_SESSION ["COMPANY"]
The query fails.
(FYI, the query will run properly if condition is modified to WHERE `department`.`Company` = 999 )
Is there a solution to including a variable in a lookup field query?
Thanks
joseph
Lookup filed: Advanced query
Re: Lookup filed: Advanced query
Hi,
you may have a look at the
$options->QueryWhere
in the init function of the hooks/TABLENAME.php file.
Here you can apply your changes. In the AppGini advanced lookup I think this is not possible.
you may have a look at the
$options->QueryWhere
in the init function of the hooks/TABLENAME.php file.
Here you can apply your changes. In the AppGini advanced lookup I think this is not possible.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Lookup filed: Advanced query
Thanks for taking the time to respond.
FYI, below is the response I received from tech support at APPGINI. A solution is in the work so will just have to wait!
The addFilter command works when using $_SESSION because it works inside PHP context rather than SQL. But we plan to add support for special tags to use in the advanced SQL tab .. for example %username%, %custom1% .. etc.
FYI, below is the response I received from tech support at APPGINI. A solution is in the work so will just have to wait!
The addFilter command works when using $_SESSION because it works inside PHP context rather than SQL. But we plan to add support for special tags to use in the advanced SQL tab .. for example %username%, %custom1% .. etc.