This topic is locked

how passing search parameter/value to List page: BeforeQueryList

11/10/2022 9:24:55 PM
PHPRunner General questions
J
jackolantern author

Hi anyone,

pls help how passing search parameter/value to List page: BeforeQueryList.
I want to implement alter query sql with custom query based on search value.

thank you so much

fhumanes 11/12/2022

Hello,

I think we do not give you any alternative because we have not understood what you want to do or where you have the problem.

Can you explain it in more detail?

Cheers,
fernando

admin 11/13/2022

Do not use BeforeSQLQuery event, use Dynamic SQL Query technique instead.

To get access to any variable in the URL use $_GET["variablename"]

J
jackolantern author 11/18/2022

Dynamic query is not an option, because its only alter where clause.But I need to alter the original query to changes based on query.
I had try $GET["variablename"], but not aplicable on "List page: Before SQL Query" (to get parameter value from search action on search panel)

Here the code

//BeforeQueryList
if (isset($_GET['period'])) //format posibility YYYY or YYYYMM
$period = $_GET['period'];
else
$period = date('Y') . '%';

$company = '';
if (isset($_GET['company'])) $company = $_GET['company'];

$strSQL ="SELECT
'".$period."%' as period,
'".$company."%' as company,
cast(`table_code` as integer) AS code,
table_desc as category,
(SELECT count(status) FROM wb_data WHERE company='$company' and `period` LIKE '".$period."%' and status=1) as received,
(SELECT count(status) FROM wb_data WHERE company='$company' and `period` LIKE '".$period."%' and status=2) as outstanding,
(SELECT count(status) FROM wb_data WHERE company='$company' and `period` LIKE '".$period."%' and status=3) as in_progress,
(SELECT count(status) FROM wb_data WHERE company='$company' and `period` LIKE '".$period."%' and status=0) as rejected,
(SELECT count(status) FROM wb_data WHERE company='$company' and `period` LIKE '".$period."%' and status=4) as closed
FROM wb_table_list
WHERE (table_type = 'KAT-LAP') AND (active = 1)
ORDER BY cast(`table_code` as integer)";
fhumanes 11/22/2022

Hello,

Phprunner allows you to change the whole Query.

img alt

What problem do you have when you run the code?

You have to keep in mind that you must maintain the number, order and the names of the recovery fields for all cases, which is what PHPRUNNER must be waiting.

Cheers,
Fernando

J
jackolantern author 12/5/2022

sorry for make mistake on question, the real question should be how passing search parameter/value to List page: Before SQL query?
I am unable get easily the parameter value from search panel.

thank you for replying fernando

S
Steve Seymour 12/5/2022

When I need to dispay a specific record called from another page I do it on the URL
example:
I have a FullCalendar displaying jobs/ dates. A user is able to click on the job on a FullCalendar embedded in a dashboard in an iFrame,
popup some detail in a SweetAlert dialog and optionally go to the job on the job list page.

In order to select that job in the listpage I past the search detail on the URL

https://xxxxxxxxxxxxxxxxxx/job_list.php?qs=200894&criteria=or&tab=job&orderby=djobno

This takes me to the list page and the selected job.

Is this something that would work for you.