Hello Support,
I am having a problem with a custom filter. I have inserted custom php code in the _list page which allows three values to be enterd then sent per GET by a reload of the _list Page.
[codebox]function Gesamt_Event1(&$params)
{
global $conn;
function setz_selected($card1,$card2)
{
if (trim($card1) == trim($card2))
return "selected";
return '';
}
echo '<FORM name=filtersetzen action=Gesamt_list.php method=get>';
echo '<table border=0>';
echo '<tr>';
echo '<td style="background:#C1E0FF;"><b>Kunde</b></td>';
echo '<td style="background:#C1E0FF;"><b>Abteilung</b></td>';
echo '<td style="background:#C1E0FF;"><b>Produkt</b></td>';
echo '<td> </td>';
echo '</tr>';
echo '<tr>';
echo '<td>';
//Account Selection
$sqllookup = "select top 100 Percent 'Accnt' as Typ, ACCOUNT as Selector, Count() as Records from dbo.tbliDEB_OP_Basis
group by ACCOUNT
order by 2";
$lookup_rs = db_query($sqllookup,$conn);
if ($lookup_data=db_fetch_array($lookup_rs))
{
echo '<select name="kunde" size="1" style="padding: 6px; width=150;">';
echo '<option value="ALL">Alle</option>';
while ($lookup_data)
{// build selectionsliste
echo '<option value='.$lookup_data["Selector"].' '.setz_selected($_GET["kunde"],$lookup_data["Selector"]).' >'.$lookup_data["Selector"].'</option>';
$lookup_data=db_fetch_array($lookup_rs);
}
echo '</select>';
}
echo '</td>';
echo '<td>';
// Department selection
$sqllookup = "select top 100 'Abt' as Typ, DEPARTMENT as Selector, Count() as Records from dbo.tbliDEB_OP_Basis D
group by DEPARTMENT
order by 2";
$lookup_rs = db_query($sqllookup,$conn);
if ($lookup_data=db_fetch_array($lookup_rs))
{
echo '<select name="abteilung" size="1" style="padding: 6px; width=100;">';
echo '<option value="ALL">Alle</option>';
while ($lookup_data)
{// build selectionsliste
echo '<option value='.$lookup_data["Selector"].' '.setz_selected($_GET["abteilung"],$lookup_data["Selector"]).' >'.$lookup_data["Selector"].'</option>';
$lookup_data=db_fetch_array($lookup_rs);
}
echo '</select>';
}
echo '</td>';
echo '<td>';
// Produkt Selection
$sqllookup = "select distinct top 100 'Prod' as Typ, Prod_line as Selector, Count(*) as Records from dbo.tbliDEB_OP_Basis P
group by Prod_line
order by 2";
$lookup_rs = db_query($sqllookup,$conn);
if ($lookup_data=db_fetch_array($lookup_rs))
{
echo '<select name="produkt" size="1" style="padding: 6px; width=100;">';
echo '<option value="ALL">Alle</option>';
while ($lookup_data)
{ // build selectionsliste
echo '<option value='.$lookup_data["Selector"].' '.setz_selected($_GET["produkt"],$lookup_data["Selector"]).' >'.$lookup_data["Selector"].'</option>';
$lookup_data=db_fetch_array($lookup_rs);
}
echo '</select>';
}
echo '</td>';
echo '<td>';
echo '<SPAN class=buttonborder><INPUT class=button type="submit" value=filtern></SPAN>';
echo '</td>';
echo '</tr>';
echo '</table>';
echo '<input type="hidden" name="a" value="filtern">';
echo '</FORM>';
}[/codebox]
The GETs are read in the Events to set the Filter or SQL String.
[codebox]/ List page: Before SQL query
function BeforeQueryList(&$strSQL,&$strWhereClause,&$strOrderBy)
{
if ($_GET["kunde"] and ($_GET["kunde"] != "ALL"))
$strWhereClause=WhereAdd($strWhereClause,"ACCOUNT = '".$_GET["kunde"]."'");
if ($_GET["produkt"] and ($_GET["produkt"] != "ALL"))
$strWhereClause=WhereAdd($strWhereClause,"PROD_LINE = '".$_GET["produkt"]."'");
if ($_GET["abteilung"] and ($_GET["abteilung"] != "ALL"))
$strWhereClause=WhereAdd($strWhereClause,"DEPARTMENT = '".$_GET["abteilung"]."'");
} // function BeforeQueryList[/codebox]
When I set the Values in the _List the Filter is set correctly. However if the results have more than 1 page when I use the pagination link to change the page the filter is no longer active.
How can I set this filter so that it works like the filter in extended search or simple search which are still active when changing the active page number??
Thanks in advance
Robert