Filter table with closed date > 21 days ago
Posted: 2018-10-29 13:54
i thought this would be easy but i am struggling to filter a table. I am looking for a way to filter based on a number of days.
A place where AppGini users can exchange ideas and help each other.
https://forums.appgini.com:443/phpbb/
https://forums.appgini.com:443/phpbb/viewtopic.php?f=7&t=2827
Code: Select all
function YOURTABLENAME_init(&$options, $memberInfo, &$args) {
$field_number = 6; // CHANGE THIS!
$options->AllowFilters = true;
addFilter(1, 'and', $field_number, '<', date('d/m/Y', strtotime('-21 days')));
return TRUE;
}
Code: Select all
$navLinks[] = array(
'url' => 'http:xxxxxxxxxxxxxxxxxxxxxx/WDCD_view.php?SortField=8&SortDirection=asc&FilterAnd%5B1%5D=&FilterField%5B1%5D=8&FilterOperator%5B1%5D=like&FilterValue%5B1%5D=CD&FilterAnd%5B2%5D=and&FilterField%5B2%5D=21&FilterOperator%5B2%5D=not-equal-to&FilterValue%5B2%5D=Closed+Cancelled&FilterAnd%5B3%5D=and&FilterField%5B3%5D=21&FilterOperator%5B3%5D=not-equal-to&FilterValue%5B3%5D=Closed+Lost&FilterAnd%5B4%5D=and&FilterField%5B4%5D=21&FilterOperator%5B4%5D=not-equal-to&FilterValue%5B4%5D=Closed+Won&FilterAnd%5B5%5D=and&FilterField%5B5%5D=21&FilterOperator%5B5%5D=not-equal-to&FilterValue%5B5%5D=Won&FilterAnd%5B6%5D=and&FilterField%5B6%5D=21&FilterOperator%5B6%5D=not-equal-to&FilterValue%5B6%5D=Cancelled&FilterAnd%5B7%5D=and&FilterField%5B7%5D=21&FilterOperator%5B7%5D=not-equal-to&FilterValue%5B7%5D=Lost',
'title' => 'CD Exc Lost/Closed Opps',
'groups' => array('*'), // groups allowed to see this link, use '*' if you want to show the link to all groups
'icon' => '',
'table_group' => '3' // optional index of table group, default is 0
);
Code: Select all
$filterdate= date('Y-m-d',strtotime('-21 days'));
$navLinks[] = array(
'url' => 'http:xxxxxxxxxxxxxxxxxxxxxx/WDCD_view.php?SortField=8&SortDirection=asc&FilterAnd%5B1%5D=&FilterField%5B1%5D=8&FilterOperator%5B1%5D=like&FilterValue%5B1%5D=CD&FilterAnd%5B2%5D=and&FilterField%5B2%5D=21&FilterOperator%5B2%5D=not-equal-to&FilterValue%5B2%5D=Closed+Cancelled&FilterAnd%5B3%5D=and&FilterField%5B3%5D=21&FilterOperator%5B3%5D=not-equal-to&FilterValue%5B3%5D=Closed+Lost&FilterAnd%5B4%5D=and&FilterField%5B4%5D=21&FilterOperator%5B4%5D=not-equal-to&FilterValue%5B4%5D=Closed+Won&FilterAnd%5B5%5D=and&FilterField%5B5%5D=21&FilterOperator%5B5%5D=not-equal-to&FilterValue%5B5%5D=Won&FilterAnd%5B6%5D=and&FilterField%5B6%5D=21&FilterOperator%5B6%5D=not-equal-to&FilterValue%5B6%5D=Cancelled&FilterAnd%5B7%5D=and&FilterField%5B7%5D=21&FilterOperator%5B7%5D=not-equal-to&FilterValue%5B7%5D=Lost&FilterField%5B8%5D=21&FilterOperator%5B8%5D=less-than&FilterValue%5B8%5D='.$filterdate,
'title' => 'CD Exc Lost/Closed Opps',
'groups' => array('*'), // groups allowed to see this link, use '*' if you want to show the link to all groups
'icon' => '',
'table_group' => '3' // optional index of table group, default is 0
);