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 Employee

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 Employee

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 Employee

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
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 (5,448)