This topic is locked

about add criteria in BeforeQueryList,problem in edit page

11/27/2012 8:10:56 PM
PHPRunner General questions
V
venfylin author

I create a page ,and base the parameter will get records(write code in BeforeQueryList),and at another page link to this with different parameter,it can success filter the record,but in edit page's next record button and previous record,can not filter.(I try to add fiter code like BeforeQueryList,but while it can not access,the edit page will change to List page).

Any advice for this request,any other better solution?

C
cgphp 11/28/2012

Post the code of the "Before SQL query" event. Post the parameters as well.

V
venfylin author 11/28/2012



Post the code of the "Before SQL query" event. Post the parameters as well.



Dear Cristian,

if ( $strWhereClause =="" )

$strWhereClause = $strWhereClause ." 1=1 ";
if ( $_SESSION["sales_code"] !="" )

{

$strWhereClause = $strWhereClause." and sales_code in ".

" (select subo".

" from bc_sales_relate".

" start wITh subo = ".$_SESSION["sales_code"].

" connect by prior subo = supv )";

}

//echo $strWhereClause;

if ($_REQUEST["init"]==true)

{

$_SESSION["search_sales_code"] = $_REQUEST["sales_code"];

$_SESSION["called"] = $_REQUEST["called"];

$_SESSION["contacted"] = $_REQUEST["contacted"];

$_SESSION["appoint_date"] = $_REQUEST["appoint_date"];

}
if ($_SESSION["search_sales_code"]!="")

$strWhereClause = $strWhereClause." and sales_code='".$_SESSION["search_sales_code"]."' ";

if ($_SESSION["called"]!="")

$strWhereClause = $strWhereClause." and call_flag='".$_SESSION["called"]."' ";

if ($_SESSION["appoint_date"]!="")

$strWhereClause = $strWhereClause." and appoint_date='".$_SESSION["appoint_date"]."' ";
if ($_SESSION["contacted"]!="")

{

if($_SESSION["contacted"]=="SUCCESS")

$strWhereClause = $strWhereClause." and CONTACT_TYPE='".$_SESSION["contacted"]."' ";

else

$strWhereClause = $strWhereClause." and (CONTACT_TYPE='".$_SESSION["contacted"]."' or CONTACT_TYPE is null) ";

}

V
venfylin author 11/28/2012

and the parameter is use url like ?init=true&sales_code=75574&called=Y&contacted=SUCCESS,thanks.