Quantcast
Channel: OutSystems Community
Viewing all articles
Browse latest Browse all 1476385

[Academy] 1.9 Page Life Cycle Overview

$
0
0
Nicholas wei wrote:
João Fernandes wrote:
Yes, the search functionality "magicaly" appears in this video.
But if you watched all the videos until now, I think you know everything you need to implement that.
Clues:
  1. You need to create a variable that stores the keyword the user is searching for;
  2. You need a button and an action that is triggered when you click that button;
  3. You need to make some changes to the Aggregate that is fetching data.
Go for it!
 Hi, Still don't understand how to create this search function, is there any step by step instruction?
 
 
I recommend you try to implement the Search functionality as already expressed. Thanks to João for the hints.
If you get stuck, this is how to implement it...
 
How to implement a basic search to the tutorial CRUD:
 
1) Right click contacts and add a variable, i.e. "SearchString"
2) Go to Contacts and add an input above the table, for Variable set "SearchString" from the drop down
3) Add a button next to the input and label it something like "Search", on destination choose (New Screen Action)
and it will add a Search action.
4) Go to Contacts->Preparation and go to the aggregate GetContactsWithOrWithoutCompanies, click on Filters...
(this is the tedious part, because you didn't know from the tutorials what was the correct notation to use for
the filters) and add a filter.
 
Now for instance if you want to search by Name or Phone Number (matching any letter / number respectively, not an
exact match) then you can do something like this:
 
Contact.Name like "%" + SearchString + "%" or Contact.PhoneNumber like "%"
 
//substitute SearchString by the name you gave to your local variable. The filter conditions can apparently be in 
//SQL-like format.
 
 
As an added bonus I implemented a "Reset" button to get out of the search and retrieve all the records.
What I did was to create a Reset button right next to the Search, assigned its own action Reset and on that action
I added an assign and selected the SearchString variable and set it to "". It works.
 
I am NOT sure if this is the recommended way as I am a total noob and I just went through the first 9 tutorials, I
have no experience whatsoever with Outsystems so don't take my word as facts.
 
I had to set the SearchString to "" instead of NullIdentifier() because Outsystems seems to equal Null to 0 and it
sets 0 in the Input. I am unsure if this is a good practice or if it will create tedious problems down the road like
the loathed empty() function in PHP.
 

Viewing all articles
Browse latest Browse all 1476385

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>