# Saving a user's last search action

**URL:** <https://community.triggre.com/t/saving-a-users-last-search-action/741>\
**Category:** Data\
**Tags:** data, designer\
**Created:** [December 31, 2019, 11:00pm UTC](https://community.triggre.com/t/saving-a-users-last-search-action/741 "2019-12-31T23:00:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mar](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.triggre.com/mar/32/395_2.png) [@Mar](https://community.triggre.com/u/Mar)\
**Post date:** [December 31, 2019, 11:00pm UTC](https://community.triggre.com/t/saving-a-users-last-search-action/741/1 "2019-12-31T23:00:00Z")

</div>

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.

## 1. Add a specific Property to the Data item

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

## 2. 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](https://canada1.discourse-cdn.com/flex035/uploads/triggre/original/1X/3a798bbe1f18397348fb25cb5b2cdb4e7d3001e7.png)

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.  
 ![Rule](https://canada1.discourse-cdn.com/flex035/uploads/triggre/original/1X/9571992d5021285cee0eb1e04e34839863f73827.png)  
 ![Function](https://canada1.discourse-cdn.com/flex035/uploads/triggre/original/1X/f46f64ddf7ca93196f324849463ee70159e13a6f.png)

5. Add the **Look up** to the **Output** of the **Flow part**.

## 3. Create the User flow

 ![User flow](https://canada1.discourse-cdn.com/flex035/uploads/triggre/original/1X/1e87a0c1c46baedf2edea08023f46a2217100fd0.png)

1. Include the **Form field** _Search_ in the left column.

2. Make it **Prefilled** with _Current user_ / _Last search_.  

3. Close the **Page** and add the **Button** named _Search to it_, that submits the **Form fields.**  

4. Add the **Flow part** _Update user_, which will store the _Search text_ in the **User profile**. Provide it with _Current User_ and _Search text_.

5. Add the **Flow part** _Search in my questions_. Provide it with _Current user_ and _Search text_.

6. Add the **Page** _Search results_.

7. Add a **Table**.  

8. Since the **Table** will present the _Search results_ that were generated in this **User flow** , select **Data** from the **User flow.**  

9. Point to the _Search results_ **List.**  

10. Complete the **Questionnaire** for the **Table**.

11. Bonus: modify the title of the **Page** to show the _Search text_.  

12. Publish the design.

## 4. Results

The **Search button** in the **Overview page**.

 ![Search button](https://canada1.discourse-cdn.com/flex035/uploads/triggre/original/1X/e66f73aee0d78ad95046c0516db6800b31669e0f.png)

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

 ![Search results](https://canada1.discourse-cdn.com/flex035/uploads/triggre/original/1X/4ec5c5e202a868bf701fbf58016b73dfce7ebbeb.png)

‍
