addFilter()
Last updated 18/03/2026
Definition
addFilter() is a function on the Five object that adds a key and its value to the Five stack.
Examples
Filtering an Orders view by the current Order
This code pushes the current form's
OrderKey
value onto the stack so that any form with a foreign key to Orders.OrdersKey
is automatically filtered by it.
Filter an Orders view by the current order
function FilterViewByOrder(five: Five, context: any, result: FiveError): FiveError {
five.addFilter('Orders.OrdersKey', five.field.OrderKey);
return five.success(result);
}
Filter an Orders view by the current order
function FilterViewByOrder(five, context, result) {
five.addFilter('Orders.OrdersKey', five.field.OrderKey);
return five.success(result);
}
Pushing multiple keys so different forms filter independently
This code adds both an
Order
and a Customer
key to the stack. Each drill down form will automatically filter by whichever of these keys its data source has a foreign key to.
Push multiple keys so different forms filter independently
function FilterViewByOrderAndCustomer(five: Five, context: any, result: FiveError): FiveError {
five.addFilter('Orders.OrdersKey', five.field.OrderKey);
five.addFilter('Customers.CustomerKey', five.field.CustomerKey);
return five.success(result);
}
Push multiple keys so different forms filter independently
function FilterViewByOrderAndCustomer(five, context, result) {
five.addFilter('Orders.OrdersKey', five.field.OrderKey);
five.addFilter('Customers.CustomerKey', five.field.CustomerKey);
return five.success(result);
}