Equivalent of {sc_where_filter} for search application?

Hello,

Is there any equivalent of {sc_where_filter} for a search application ?
Is it possible with javascript or php to store the selection in a variable ?

Thanks for your help.

Here is more information on my problem: I want to make a sc_redir from a search application to a grid application with the where_filter string.
(Because it is not possible to make an application link to a grid but only to a form).

{sc_where_filter} is apparently not available in a search application but if I add the following code (*) at the end of the function monta_form() generated by scriptcase in MySearch_test_call_grid_pesq.class.php, I can see the where_filter string

(*) only to debug because the code is always regenerated by scriptcase

$debug = $_SESSION[‘sc_session’][$this->Ini->sc_page][‘BDO_PR01_Search_test_call_grid’][‘where_filter’];

echo '<pre>' , var_dump($debug) , '</pre>';

Here is the result of this code

Unfortunatly, if I add this code in the onValidate event of the search application, it doesn’t work.

My question is:
Is it possible to intercept the where_filter string that exist at the end of the function monta_form() generated by scriptcase for using it in the onValidate event in the sc_redir macro of the search application ?

Hello.
Have you tried to play around with “sc_where_current” and “sc_where_orig” macros ?

Yes. Thank you.

sc_where_current has the same scope as sc_where_filter and the same error message when trying to use in onValidate event in a search application (“Undefined property”)

sc_where_orig has a wider scope according to the documentation but I can’t find the onAfterValidate event as explained in the documentation.
When used in onValidate event, I receive the same message

2020-10-26_134656

Looks like the documentation is obsolete and the event names have changed.
I can find the the “onScriptInit”, “OnRefresh”, “OnSave” and “OnValidate” events in the “Advanced Searched/Events” section in a Grid Application.
I’m able to use “sc_where_current” in the “onInit” of a grid application.
Can’t say more, sorry. I’ve never used a search application.

Thank you anyway for your intervention.

I have the beginning of a solution.
The use of the following instruction works in onValidate event
$debug=$_SESSION[‘sc_session’][$this->Ini->sc_page][‘BDO_PR01_Search_test_call_grid’][‘grid_pesq’];

For the above example, it gives me the following array

array(5) {
[“pr_numero”]=>
array(3) {
[“val”]=>
array(1) {
[0]=>
array(1) {
[0]=>
string(4) “4567”
}
}
[“cmp”]=>
string(9) “pr_numero”
[“opc”]=>
string(2) “gt”
}
[“pr_nroconvention”]=>
array(3) {
[“val”]=>
array(1) {
[0]=>
array(1) {
[0]=>
string(5) “56789”
}
}
[“cmp”]=>
string(16) “pr_nroconvention”
[“opc”]=>
string(2) “lt”
}
[“pr_datdebengag”]=>
array(3) {
[“val”]=>
array(2) {
[0]=>
array(3) {
[0]=>
string(4) “D:10”
[1]=>
string(4) “M:11”
[2]=>
string(6) “Y:2012”
}
[1]=>
array(3) {
[0]=>
string(4) “D:10”
[1]=>
string(4) “M:11”
[2]=>
string(6) “Y:2012”
}
}
[“cmp”]=>
string(14) “pr_datdebengag”
[“opc”]=>
string(2) “eq”
}
[“id_nom”]=>
array(3) {
[“val”]=>
array(1) {
[0]=>
array(1) {
[0]=>
string(4) “azer”
}
}
[“cmp”]=>
string(6) “id_nom”
[“opc”]=>
string(2) “qp”
}
[“id_prenom”]=>
array(3) {
[“val”]=>
array(1) {
[0]=>
array(1) {
[0]=>
string(6) “razer”
}
}
[“cmp”]=>
string(9) “id_prenom”
[“opc”]=>
string(2) “np”
}
}

OnScriptIni

if ( isset( $_SESSION[‘sc_session’][$this->Ini->sc_page][‘BDO_PR01_Search_test_call_grid’][‘where_filter’]) ) {
$debug = $_SESSION[‘sc_session’][$this->Ini->sc_page][‘BDO_PR01_Search_test_call_grid’][‘where_filter’];
echo ‘

’ , var_dump($debug) , ‘
’;
sc_redir(app,’_self’);
}

1 Like