Skip to main content

stack

Last updated 19/12/2025

Five automatically filters forms for you, however, you can use the

stack
property on the
Five
object in your functions and queries to filter and manipulate data for your requirements.

The

stack
property on the
Five
object works at the database-level and returns the primary keys of the associated data sources for the forms stacked above the current action in the format of
five.stack.<dataSourceId>.<primaryKey>
. These keys can be used to filter the records that are associated with the parent form.

During the life time of your application a user will open records, select form records, open subforms, and drill down into related forms. The

stack
property will keep track of associated data based on the data sources related to the forms the user is currently working with.

The

stack
property is not available on the application and table events, or the Do Complete event on a form.

five.stack.<dataSourceID>.<primaryKey>
can be used on most of the event fields, with the exception of the above fields. It can also be used in the following form fields and screen fields:

  • Show If
  • Required If
  • Read Only If

When using the

stack
property for an action other than a form action, it must be under a form, otherwise the
stack
will be empty.

What five.stack.<dataSourceID>.<primaryKey> Represents

five.stack
contains all the primary keys for the forms stacked above the current action.

dataSourceID
is the data source ID associated to the form in the stack - for example:

  • Portfolio
  • Buy

primaryKey
is the primary key associated with the data source for the form in the stack - for example:

  • PortfolioKey
  • BuyKey

So when you write

five.stack.Portfolio.PortfolioKey
you are accessing the value of the field PortfolioKey on the Portfolios form in the
stack
referencing the Portfolio data source.

How it Works

Reading a value:

Gets the primary key stored in the PortfolioKey field
const keyInStack = five.stack.Portfolio.PortfolioKey

Working With Query Parameters

The

stack
property can be used as a parameter in your queries, this needs to be defined on the Parameters page on the Queries form in the following format:

{{five.stack.Portfolio.PortfolioKey}}

Examples

stack