cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper II
Helper II

Toggle filter

I have a gallery filter with items = SortByColumns(Filter(Clients, StartsWith(Title,TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

 

the above is working and it gives me all the projects but now I need to add a toggle filter so that from the above result I filter again if the projects are assigned.

 

can you help me on how to do it please ?

 

thanks

21 REPLIES 21

ok so i attached a snapshot of the application, I have three data items, client name, client code and assigned to. The search at the top at the moment is only searching for the client name. How can I modify it to search for client code or assigned to ?

 

thanks

 

You mentioned that you want the second filter to be triggered by a toggle control. Does this mean that you want to search by "client code" when the toggle is ON and search by "assigned to" when the toggle is OFF? It is still not clear how are you planning to provide the search strings (the client code and the assigned to search values you want to filter by).

I would like to understand the intended behavior.

no, let's forget the toggle. can i search for client name, client code or assigned to from the same search box ?

Yes. You can add multiple search/filter criterias. Please try the following:

SortByColumns(Filter(Clients, StartsWith(Title,TextSearchBox1.Text) Or StartsWith(Assigned_To,TextSearchBox1.Text) Or StartsWith(ClientCode,TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

Note that the formula above will find records where Title, AssignedTo or ClicnetCode starts with a value provided in the TextInput. If you prefer to find records where Title, AssignedTo or ClientCode contain the search value (as opposed to starts with) then your formula will be:

SortByColumns(Filter(Clients, TextSearchBox1.Text in Title Or TextSearchBox1.Text in Assigned_To Or TextSearchBox1.Text in ClientCode), "Title", If(SortDescending1, Descending, Ascending))

Note the "in" operator which allows you to find the records. 

 

View solution in original post

Hi there,

 

Similar issue which I can't figure out.

 

I am trying to Filter or StartWith "Not assigned" once toggle= true

 

SortByColumns(Filter('Titan Asset List', If(Toggle1.Value=true, StartsWith(Status.Value="Not assigned",TextSearchBox1.Text), StartsWith(Asset_x0020_number,TextSearchBox1.Text))), "Asset_x0020_number", If(SortDescending1,Descending,Ascending))

Thanks in advance

@Minde23 

This is not going to work for you...Your StartsWith is not specifying a column but rather a condition (Status.Value="Not assigned") - it needs to be a column.

SortByColumns(
Filter('Titan Asset List',
If(Toggle1.Value,
StartsWith(Status.Value="Not assigned",TextSearchBox1.Text),
StartsWith(Asset_x0020_number,TextSearchBox1.Text))
),
"Asset_x0020_number",
If(SortDescending1,Descending,Ascending)
)

If you are trying to Filter for the "Not assigned" when the Toggle is true, then perhaps consider this:

SortByColumns(
Filter('Titan Asset List',
If(Toggle1.Value, StartsWith(Status.Value, "Not assigned"), true) &&
StartsWith(Asset_x0020_number,TextSearchBox1.Text)
),
"Asset_x0020_number", If(SortDescending1,Descending,Ascending)
)
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Hi RandyHayes,

 

Works very well thank you very much.

 

However, sorting it ascending, descending by Asset Number doesnt work as it should, please see pics attached.

 

I would like togle to filter out Not assigned asset numbers and Sort asseets lowest to highest and versa.

 

Thanks

@Minde23 

Very good.

 

For the sorting - but pictures looked like the asset number was sorted.  I'm not sure what the problem is with what you have in the pictures.

However, if you're having issues with sorting, I would have to ask - what is SortDescending1 ?  I had assumed in the response that it was just a variable, but if it is something else, then perhaps that is where you are having sort issues.

 

So, if you are trying to filter out Not Assigned, then that second example I gave you should do the trick.

 

Hope that helps some.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Hi RandyHayes,

 

Asset numbers are not being sorted in lowest to highest number note: 00003 is missing some of the assets ar found at random placed. 

 

IconSortUpDown1

OnSelect: UpdateContext({SortDescending1: !SortDescending1})

 

Thanks

@Minde23  Everything looks good in what you are doing.

Are you sure the actual data is as you expect?  What if you sort the list in SharePoint directly...what happens with asset 00003?  How does asset 00003 meet the filter criteria - or does it?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (47,277)