Add a custom search feature

Steve
Platinum 5
Platinum 5

Create a Search table

Add a Search table based on your preferred data source. This is a table that will control the searches, not the table to be searched; the table to be searched will be determined later. In this example, the data source is Google Sheets.

This table needs at least two normal (not virtual) columns: a key column and a column to receive the search term. In this example, the key column is named user and the search term will be stored in search.

Steve_0-1737731401078.png

Configure the user column

Steve_1-1737731420689.png

Set Initial value

In this example, the key column value is set to the email address of the user who adds the Search row. This allows for only one Search row per user.

Steve_2-1737731432542.png

Add the results virtual column

Return to the Search table column list and click Add virtual column to add a column to contain the search results. In this example, the column is named results.

Steve_5-1737731606534.png

Identify search targets

The App formula of the results column is used to gather the rows that match the user's search term. In this example, the results are rows of another table that contain the search term in either of several of its columns. The App formula expression should be tailored to your particular needs and the structure of your target table.

Steve_6-1737731628281.png

Confirm column configuration

After entering the App formula expression for the results column, ensure the remaining column configuration is appropriate. For this example, the search results will be rows of the Example table. Rows of a table are best displayed as a List. A row is represented by a Ref column type. The Referenced table name (the name of the table containing the rows in the List) should match the table used by the App formula.

Steve_7-1737731649372.png

Configure the Search table

Return to the column list of the Search table and click the Table settings icon.

Steve_3-1737731442066.png

Add a security filter

The current user should only have access to their own Search table row, both to protect the privacy of other users and to avoid the performance impact of loading unneeded searches of other users. The view configurations below assume that the Search table will include only the on row of the current user.

Steve_4-1737731478540.png

Create the Search view

The Search view itself is a detail view for the Search table. For this example, the Search table loads only the current user's row, so the table will have at most only one row and this view will only ever show the current user's row of the Search table.

Steve_8-1737731703450.png

Allow the user to enter a search term

Add the search column to the list of Quick edit columns for the row. This will allow the user to edit the search term within the detail view itself without needing to navigate to and submit a form view.

Steve_9-1737731752285.png

Only display if user's search is setup

If the user doesn't yet have a row in the Search table, this detail view will have nothing to show and the view's appearance will likely cause confusion. Therefore, it's best to hide the Search view if the user's Search table row doesn't exist.

Steve_13-1737731840699.png

Create Add Search view

If the user does not yet have a row in the Search table, the user should be presented with the option to add it. For this example, the option is given as a form view named Add Search.

Steve_10-1737731767503.png

Allow search term and continue to Search view

In addition to simply adding the user's Search table row, this Add Search form allows the user to enter a search term to perform their first search by displaying the search column in the view. Setting Finish view to the Search view created previously will present the user with the results of their first search and allow further searches upon submitting this form.

Steve_11-1737731785480.png

Only display if the user's search isn't setup

The Add Search view is intended only to add the user's Search table row if the row does not already exist. If the row already exists, the Add Search view should not be displayed.

Steve_12-1737731802068.png

Open the Add Search view

In the app emulator or from the app itself, navigate to the Add Search view.

Steve_14-1737731855774.png

Save the new search row

From the Add Search form, optionally enter a search term, then click Save.

Steve_15-1737731868708.png

Behold your new custom search feature!

If configured as described here, the resulting view should be similar to this:

Steve_16-1737731884502.png

11 1 314
1 REPLY 1

Nice setup Steve and your tip explanation is very systematic.

An effective search capability is essential in many apps, especially in apps such such as inventory management etc.

Thank you very much for this practical tip.

Top Labels in this Space