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

Search by choice and single-line values

Hi guys,

 

I'm pretty sure I'm missing a simply concept here.  I've searched various threads such as...

 

https://powerusers.microsoft.com/t5/General-Discussion/SharePoint-Lists-Powerapps-won-t-search-quot-...

 

But I'm not seeing how to search with a mixture or choice and single-lined text values.  

 

For example this is the search formula which works great when filtering off various single values.  

 

SortByColumns(Search('Assignments Sidney',TextSearchBox.Text,"MarketSegment","Onboarding_x0020_Status","Customer_x0020_Type","Priority","Title","t7pz", "nnis","Geo"),"Title",If(SortDescending1,Descending,Ascending))

 

My question is how do I include a choice field in the search along with single-lined values in my existing working search formula above?

 

Choice Field Example:

Name: StatusJustification (Not Connected, Connected, Assigned, etc).  

 

Thanks,

-Sidney

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Microsoft dinusc
Microsoft

Re: Search by choice and single-line values

The "DataCardValue70_1" is actually a ComboBox control so you can reference the selected value from it (as you would in case of a DropDown control).

From what I see, the only issue you currently have is with the way to access the selected choice value. I think there're 2 different ways you could do that.

1. If your SharePoint field does not allow multiple selections, you can just simple have DataCardValue70_1.Selected.Value (example ... Or TextSearchBox.Text=DataCardValue70_1.Selected.Value) You can check if the Choice fields allows multiple selectinos directly from PowerApps, by checking the DataCardValue70_1.SelectMultiple property from the Advanced Panel on the right. If it's "false" then you Choice field does not allow multiple selections which makes everything easier.

2. If you're dealing with a Choice field that does allow multiple selections, then your formula would be ... Or TextSearchBox.Text in DataCardValue70_1.SelectedItems.Value... (note that the equality operator has been replaced by "in")

View solution in original post

sidney80
Level: Powered On

Re: Search by choice and single-line values

@dinusc - Thanks, I'll give this a go.  Appreciate the help. 

 

Cheers!

-Sidney

View solution in original post

4 REPLIES 4
Microsoft dinusc
Microsoft

Re: Search by choice and single-line values

Hello Sidney,

It seems like you already figured out how to Filter text and choices fields separately. Have you tried comboning them by using the OR operator? From the example from your link wich Choices example, this could be something like:

SortByColumns(Filter('Safety Concentration Time Tasks', StartsWith(Locations.Value, TextSearchBox1.Text) OR ddLocations.Selected.Value = Locations.Value), "ComplianceAssetId", If(SortDescending1, Descending, Ascending))

 

sidney80
Level: Powered On

Re: Search by choice and single-line values

Thanks for the response @dinusc.  

 

I've tried my best to mirror the thread example but it doesn't seem to like my entries.  I tried to include the "Or" statement but I think I'm messing up the call out to the choice column which should be "OnboardingStatusJustification".  I don't have a drop down create it's basically being pulled from Sharepoint.  The only reference name beside the column name is that the value appears under DataCardValue70_1 (See below for existing screenshots)

 

SortByColumns(Filter('Assignments Sidney', StartsWith(MarketSegment, TextSearchBox.Text) Or OnboardingStatusJustification.Selected.Value), "Title", If(SortDescending1, Descending, Ascending))

Would it be possible to still use this working formula below and just include the "choice" field as a search parameter?  

 

SortByColumns(Search('Assignments Sidney',TextSearchBox.Text,"MarketSegment","Onboarding_x0020_Status","Customer_x0020_Type","Priority","Title","t7pz", "nnis","Geo"),"Title",If(SortDescending1,Descending,Ascending))

Example.png

OSJ_Choice.png

 

Thanks,

-Sidney

Microsoft dinusc
Microsoft

Re: Search by choice and single-line values

The "DataCardValue70_1" is actually a ComboBox control so you can reference the selected value from it (as you would in case of a DropDown control).

From what I see, the only issue you currently have is with the way to access the selected choice value. I think there're 2 different ways you could do that.

1. If your SharePoint field does not allow multiple selections, you can just simple have DataCardValue70_1.Selected.Value (example ... Or TextSearchBox.Text=DataCardValue70_1.Selected.Value) You can check if the Choice fields allows multiple selectinos directly from PowerApps, by checking the DataCardValue70_1.SelectMultiple property from the Advanced Panel on the right. If it's "false" then you Choice field does not allow multiple selections which makes everything easier.

2. If you're dealing with a Choice field that does allow multiple selections, then your formula would be ... Or TextSearchBox.Text in DataCardValue70_1.SelectedItems.Value... (note that the equality operator has been replaced by "in")

View solution in original post

sidney80
Level: Powered On

Re: Search by choice and single-line values

@dinusc - Thanks, I'll give this a go.  Appreciate the help. 

 

Cheers!

-Sidney

View solution in original post

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,489)