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

Combine filter gallery statements for dates and startswith

Hi,

i'm looking for help to combine two expressions to filter a gallery by two dates pickers (from and to) and a name search e.g. show results in gallery if dates are between 01/01/20 and 01/08/20 and client name starts with 'a'. I can get them to work individually just need to know how to combine them together. Here is what i have:

Date Picker: SortByColumns(Filter(SPlist,StartsWith(SPName,SearchBox.Text)),"ID",If(SortDescending1, Ascending,Descending))

 

Name Search: Filter(List, (ColDate>=DateFrom.SelectedDate) && (ColDate <=DateTo.SelectedDate))

 

any help much appreciated

 

thanks

 

Mike

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @mikiepat ,

Do you want to filter based on a textinput and two date pickers?

If so, you just need to set the gallery's Items based on these three controls.

Could you tell me the data type of ColDate column? I assume that it is date column(not includes time).

Try to set the gallery's Items like this:

SortByColumns(
Filter(SPlist,
       StartsWith(SPName,SearchBox.Text),
       ColDate>=DateFrom.SelectedDate, 
       ColDate <=DateTo.SelectedDate
       ),
"ID",If(SortDescending1, Ascending,Descending))

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
pawanjajoo
Resolver I
Resolver I

Hi @mikiepat ,

 

you can collect the two outputs in a collection and then combine them into 3rd collection.

 

ClearCollect(Collect1, <Your formula to get 1st set of records>)

ClearCollect(Collect2, <Your formula to get 2nd set of records>)

ClearCollect(ColCombine, Collect1, Collect2)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

v-yutliu-msft
Community Support
Community Support

Hi @mikiepat ,

Do you want to filter based on a textinput and two date pickers?

If so, you just need to set the gallery's Items based on these three controls.

Could you tell me the data type of ColDate column? I assume that it is date column(not includes time).

Try to set the gallery's Items like this:

SortByColumns(
Filter(SPlist,
       StartsWith(SPName,SearchBox.Text),
       ColDate>=DateFrom.SelectedDate, 
       ColDate <=DateTo.SelectedDate
       ),
"ID",If(SortDescending1, Ascending,Descending))

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thanks for your response,

 

I wasn't able to apply your solution so i ended up using a Toggle control instead to flip between date and client search. Which the customer was happy with.

 

Mike

Hi @mikiepat ,

I'm glad that you've found the satisfied solution.

Do you have any other problem?

If not, could you mark my answer as solution?

Thanks!

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (94,233)