Hello, I am trying to add "Search" feature in Service Desk sample.
I am trying to add sample in Items to display user input text.
At first I added serchbox text for user input text. Then try to display tickets by user input text.
But It's not work well. So is there any sample code to add this kind of to serach and display by "user input text".
Sorry for I'm beginner to use this app and control. So I could not catch up the code well.
This is what I want to do with using this sample.
1. User input text added Text input box
2. Search in word what user input text in description on Ticket table.
3. Only display tickets what are included by user input text.
To achieve this, generally, you need to use the Filter/Search function on the Items property of Gallery control.
1. Add the TextInput control name it "TextSearchBox1".
2. Add a Gallery, set he DataSource of Gallery control to your Ticket table.
3. Set the Items property of Gallery control to some formula like this:
Sort( If( IsBlank(TextSearchBox1.Text), Ticket, Filter( Ticket, TextSearchBox1.Text in Text(Column1) ) ), Column1, SortOrder.Descending)
This formula means that:
When your type in the TextSearchBox1, the Gallery will find a set of records that match what you type in Column1 and to discard those that don't. Then sort the table by its Column1 column in descending order. If the TextSearchBox1 is blank, then it will sort all records in descending order.
For your reference about the related functions:
Sort and SortByColumns functions in PowerApps
Filter, Search, and LookUp functions in PowerApps
If and Switch functions in PowerApps
Show a list of items in PowerApps
Mona, thank you for your reply. I try to make it but it's not going well because I have not created from scratch using "ServiceDesk" sample of PowerApps.
I added your reply formula of the Top page of the sample.
I can added text input box and named as following.
Then, should I add your fomula at top of the below sample fomula, right this?
Sort( If( IsBlank(TextSearchBox1.Text), Ticket, Filter( Ticket, TextSearchBox1.Text in Text(Column1) ) ), Column1, SortOrder.Descending),If(type="All",Tickets,If(type="Tickets older than 3 days", Filter(Tickets, DateCreated <> datetype && DateCreated <>Text(Today()), DateCreated <> Text(DateAdd(Today(), -2)),DateCreated <> Text(DateAdd(Today(), -1))|| DateClosed <> datetype && DateClosed <> Text(Today()), DateClosed <> Text(DateAdd(Today(), -2)),DateClosed <> Text(DateAdd(Today(), -1))),If(type="Tickets opened today",Filter(Tickets,datetype in DateCreated),If(type="Tickets closed today",Filter(Tickets,datetype in DateClosed),Filter(Tickets,type in Status)))))