Topics and lessons

Saving a user’s last search action

To save the user’s last search action, you need to create your own search form. It will save the last search action in the assigned data item.

When the user enters the user flow, the search string will be present in the search field, so the user can use it again straight away.

In this lesson:

  1. Add a specific property to the Data item
  2. Create the Flow part
  3. Create the User flow
  4. Results

Add a specific property to the Data item

  1. Add the Any text property Last search to preserve the search text you used.

Create the Flow part

For every search action you use in the application, you need to create a flow part. In this example, the search button is included in the page My answered questions. The flow part must find the answered questions of the current user that contain the search text.

flow-part-search-results
  1. Define two inputs: the Current user and the Search text.
  2. Create a look up for the questions that the current user has answered AND that contain the search text.
  3. Use the function TEXT A CONTAINS B.
  4. Within that function, convert both the question and the search text to lower- or upper case, so all matches will pass the filter.
filter-convert-search-text
filter-text-lower-case
  1. Add the look up to the output of the flow part.

Create the User flow

user-flow-answered-questions
  1. Include the form field Search in the left column.
  2. Make it prefilled with Current user / Last search.
my-questionnaires-page
  1. Close the page and add the button named Search to it, that submits the form fields.
user-flow-search-results
  1. Add the flow part Update User, which will store the search text in the User profile. Provide it with Current User and Search text.
  2. Add the flow part Search in my questions. Provide it with Current User and Search text.
  3. Add the page Search results.
  4. Add a table.
search-result-table
  1. Since the table will present the search results that were generated in this user flow, select Data from the user flow.
add-content-dialog
  1. Point to the search results list.
add-content-dialog-page
  1. Complete the questionnaire for the table.
  2. Bonus: modify the title of the page to show the search text.
modify-page-title
  1. Publish the design.

Results

The search button in the overview page.

search-button-overview-page

The search results
The results show both lower case text and mixed case text (“in” and “In”).

search-results