cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
atashiro
Level: Powered On

Additional feature as Search in sample apps

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.

2 REPLIES 2
Community Support Team
Community Support Team

Re: Additional feature as Search in sample apps

Hi @atashiro,

 

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

https://docs.microsoft.com/en-us/powerapps/functions/function-sort

Filter, Search, and LookUp functions in PowerApps

https://docs.microsoft.com/en-us/powerapps/functions/function-filter-lookup

If and Switch functions in PowerApps

https://docs.microsoft.com/en-us/powerapps/functions/function-if

Show a list of items in PowerApps

https://docs.microsoft.com/en-us/powerapps/add-gallery

 

Regards,

Mona

 

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
atashiro
Level: Powered On

Re: Additional feature as Search in sample apps

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)))))

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,097)