Search code examples
outsystems

How to search item in outsystems input box dynamically


I am using outsystems platform to develop applications. In that I am searching the Items using input box for that I want search Item at the time of typing name of item in input box and search result should display without button click. How to do this in Outsystems please help me out..


Solution

  • You can do what you want very easily. We can split what you want to do in 2 steps:

    1. Trigger a logic when the input box changes.

    The input box has a property called "Destination" inside the "On Change" section. In that property, you can assign an action (imagine an action as a Java or .NET method). As you can figure out, that will be the action that will run when you change the input box text;

    1. Update the search result.

    In the action assigned to the "Destination" property, you should rerun the search using the "Refresh Data" widget and selecting the query. Then you must need to refresh the element in the screen. To do that, you can use the "Ajax Refresh" widget, and select the widget that is displaying the results.

    Example: Let's imagine that you have a data entity called "City" that represents.. a city. In the screen, you have an input box and below a "Table Records" with the list of cities. As you type in the input box, the "Table Records" is filtered using the value of the variable assigned to the input box.

    To achieve this, you assign an action to the "Destination" property of the input box (let's call the action "OnChange"). In the "OnChange" action, you rerun the aggregate being used to display the cities names (and that has a condition City.Name like InputBox_Var + "%") using the "Refresh Data".

    After that, you put the "Ajax Refresh" widget next to the "Refresh Data", and select the aggregate (ensure that the aggregate has a name, otherwise you can't select it).

    It should work!

    P.S.: I made a sample oml http://www.filedropper.com/livefilter

    Later, you can understand better what is happening and what you can do here:

    Filtering Results in a Data query -> http://www.outsystems.com/help/servicestudio/9.0/Using_Data/aggregates/Filtering_Results.htm