HINT: lookign at your query, if you can accept cahanging your sql a bit, you can still use as a view or custom view, ie leave all get dynamic parameter filter in the where clause. eg if you can write your sql like so
CHANGE THIS
"SELECT f.ArticelID, f.CustomerPos FROM DTA_AUFPOS f LEFT JOIN DTA_IST_AGANG s ON f.Barcode=s.Barcode AND s.Agang='".= $GET['Agang'] . "' WHERE s.ROWID is NULL AND f.ProjectID=".$GET['ProjectID'] . " AND f.OrderID=".$_GET['OrderID'];
TO THIS
"SELECT f.ArticelID, f.CustomerPos FROM DTA_AUFPOS f LEFT JOIN DTA_IST_AGANG s ON f.Barcode=s.Barcode AND s.ROWID is NULL WHERE s.Agang = '".$GET['Agang']."' AND f.ProjectID=".$GET['ProjectID'] . " AND f.OrderID=".$_GET['OrderID'];
NOTICE how all values after the where are got from the $_GET,so this kind of query can be used to create a view or a custom view, after that set each of the where parameters as extended filter which serach set to "=" and you should have what you want.
/////////////////////////BUT BUT, IF still you wnat the approach of having a dynamic join depending on your get parameters////////////////////////////
Its kind of tricky, But ive done soemthing similar where I had a custom field on a list, but whose sql expression changes dynamically, for this you need to use page_load to access the sql query that was about to be run, then modify it to your need (but ensure to still leave all field names as known in field settings in that query),for example
- Your case requires all the sql query to be visible so you can modify it, so craete a custom view of your query with default conditions to act as palce holders which you will need to modify, for example your query can be like below
SELECT f.ArticelID, f.CustomerPos FROM DTA_AUFPOS f LEFT JOIN DTA_IST_AGANG s ON f.Barcode=s.Barcode AND s.Agang='MY-Agang' WHERE s.ROWID is NULL AND f.ProjectID= 'MY-ProjectID' AND f.OrderID= 'MY-OrderID'
NOTICE IVE named all parameters we need to midify as MY-Agang, MY-ProjectID, MY-OrderID
Set this up in phpmaker and enable all three field to use extended filter or draw you own filters
We need to capture all parameters passed in each of the extended filters so we can modify our sql in page load, so save each of the filters here
NOTE:phpmaker list pages always pass thier parameters using GET so we capture them there
function Page_Load()
{
//save all the parameters in asession to help resume later
if(isset($GET["x_Agang"]) && isset($GET["x_ProjectID"]) && isset($GET["x_OrderID"]))
{
$SESSION["current_Agang"] = $GET["x_Agang"];
$SESSION["current_ProjectID"] = $GET["x_ProjectID"];
$SESSION["current_OrderID"] = $_GET["x_OrderID"];
}
}
- You can see and edit the sql being used on list page of your custom view, go to page_load of list and add this so page_load looks like so
NOTE:we need to replace the place holders in basic query then save it back
function Page_Load()
{
//save all the parameters in asession to help resume later
if(isset($_GET["x_Agang"]) && isset($_GET["x_ProjectID"]) && isset($_GET["x_OrderID"]))
{
$_SESSION["current_Agang"] = $_GET["x_Agang"];
$_SESSION["current_ProjectID"] = $_GET["x_ProjectID"];
$_SESSION["current_OrderID"] = $_GET["x_OrderID"];
}
//we always pick them from session only
if(isset($_SESSION["current_Agang"]) && isset($_SESSION["current_ProjectID"]) && isset($_SESSION["current_OrderID"]))
{
//get the sql select statement used
$sql = $this->getSqlSelect();
var_dump("<br>before".$sql);
//edit the sql to add values for each place holder
//replace MY-Agang
$sql = str_ireplace("MY-Agang",ew_AdjustSql($_SESSION["current_Agang"]),$sql);
$sql = str_ireplace("MY-ProjectID",ew_AdjustSql($_SESSION["current_ProjectID"]),$sql);
$sql = str_ireplace("MY-OrderID",ew_AdjustSql($_SESSION["current_OrderID"]),$sql);
var_dump("<br>after".$sql);
//save the qsl back
$this->setSqlSelect($sql);
}
}
- For you case since all extended filters are only used to edit your sql, you dont need them to be added in awhere clause so disable all default phpmaker generated searching in by code below
function Page_Selecting(&$filter) {
// Enter your code here
//dont apply filter here
$filter = "";
}
NOTE: The whole idea is to change the sql dynamically, Ive only used it on default list pages so I cant gaurantee its behaviour of reports of type cross tab or detai summary or even charts, but the approcah is something like that