taubes
Member
Hi,
I hope somebody can help me here.
I am using a custom button to generate a custom PDF from the results_grid (see below). The only variable that I can use is $table_name. Is there a way to access the filter, set by search and quick search in my custom_function.
(...)
$custom_buttons['some_table'][$cnt]['callback_function'] = 'dadabik_custom_function';
$custom_buttons['some_table'][$cnt]['show_in'] = 'results_grid';
(...)
function dadabik_custom_function($table_name, $where_field, $where_value) {
global $conn;
$sql = "SELECT * FROM :table_name ";
$res_prepare = prepare_db($conn, $sql);
$res_bind = bind_param_db($res_prepare, ':table_name', $table_name);
$res = execute_prepared_db($res_prepare,0);
$row = fetch_row_db($res_prepare);
(...)
}
What I would like to do is:
(...)
$custom_buttons['some_table'][$cnt]['callback_function'] = 'dadabik_custom_function';
$custom_buttons['some_table'][$cnt]['show_in'] = 'results_grid';
(...)
function dadabik_custom_function($table_name, $where_field, $where_value) {
global $conn;
$filter = xxx; // something like WHERE username_user = 'xxxx' AND year = 'xxxx'
$sql = "SELECT * FROM :table_name :filter";
$res_prepare = prepare_db($conn, $sql);
$res_bind = bind_param_db($res_prepare, ':table_name', $table_name);
$res_bind = bind_param_db($res_prepare, ':filter', $filter);
$res = execute_prepared_db($res_prepare,0);
$row = fetch_row_db($res_prepare);
(...)
}
Thanks so much for your help
Stefan
+++ using DaDaBIK version 9.2.2-Monterosso enterprise
I hope somebody can help me here.
I am using a custom button to generate a custom PDF from the results_grid (see below). The only variable that I can use is $table_name. Is there a way to access the filter, set by search and quick search in my custom_function.
(...)
$custom_buttons['some_table'][$cnt]['callback_function'] = 'dadabik_custom_function';
$custom_buttons['some_table'][$cnt]['show_in'] = 'results_grid';
(...)
function dadabik_custom_function($table_name, $where_field, $where_value) {
global $conn;
$sql = "SELECT * FROM :table_name ";
$res_prepare = prepare_db($conn, $sql);
$res_bind = bind_param_db($res_prepare, ':table_name', $table_name);
$res = execute_prepared_db($res_prepare,0);
$row = fetch_row_db($res_prepare);
(...)
}
What I would like to do is:
(...)
$custom_buttons['some_table'][$cnt]['callback_function'] = 'dadabik_custom_function';
$custom_buttons['some_table'][$cnt]['show_in'] = 'results_grid';
(...)
function dadabik_custom_function($table_name, $where_field, $where_value) {
global $conn;
$filter = xxx; // something like WHERE username_user = 'xxxx' AND year = 'xxxx'
$sql = "SELECT * FROM :table_name :filter";
$res_prepare = prepare_db($conn, $sql);
$res_bind = bind_param_db($res_prepare, ':table_name', $table_name);
$res_bind = bind_param_db($res_prepare, ':filter', $filter);
$res = execute_prepared_db($res_prepare,0);
$row = fetch_row_db($res_prepare);
(...)
}
Thanks so much for your help
Stefan
+++ using DaDaBIK version 9.2.2-Monterosso enterprise