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

Filtering gallery based on a drop down/text field and also on a date value that is between 2 other dates

I’m having such a hard time with this. 
I have a app that if you choose a value In a drop down list, then type in the search text box that it searches what was typed in that specific column. I also have 2 fields called “publication date”, one is a To and the other is a From. Basically they can choose a set of dates and the gallery would show only those documents that was published between those 2 dates.

im having a hard time putting both these together on the gallery items.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Hi @Km00 ,

Note that the below is syntax guidance and was OCR'd (posting code in Text is always something you should do) and free-typed. So if there are errors please analyze the code and try to resolve before responding.

With(
   {
      wDoc:cbDocSearch.Selected.Value,
	  wSearch:SearchDocTitle.Text
   },
   Sort(
      Filter(
         'New Item Only Action Log’,
         'publication date' >= YourStartDate &&
         'publication date' <= YourEndDate &&
         (
            IsBlank(wSearch) ||
            Switch(
               wDoc,
               "Document Title",
               wSearch in Doc_Title_DisplayName,
               "Document Owner",
               wSearch in Doc_Owner_DisplayName,
               "Document Owner Designee",
               wSearch in DO_Designee_DisplayName,
               "Document Owner’s Team",
               wSearch in SO_Dept_DisplayName
            )
         )
      ),                        
      Doc_Title,
      Ascending
   )
)

 

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.

View solution in original post

5 REPLIES 5
Super User III
Super User III

Hi @Km00 ,

Note that the below is syntax guidance and was OCR'd (posting code in Text is always something you should do) and free-typed. So if there are errors please analyze the code and try to resolve before responding.

With(
   {
      wDoc:cbDocSearch.Selected.Value,
	  wSearch:SearchDocTitle.Text
   },
   Sort(
      Filter(
         'New Item Only Action Log’,
         'publication date' >= YourStartDate &&
         'publication date' <= YourEndDate &&
         (
            IsBlank(wSearch) ||
            Switch(
               wDoc,
               "Document Title",
               wSearch in Doc_Title_DisplayName,
               "Document Owner",
               wSearch in Doc_Owner_DisplayName,
               "Document Owner Designee",
               wSearch in DO_Designee_DisplayName,
               "Document Owner’s Team",
               wSearch in SO_Dept_DisplayName
            )
         )
      ),                        
      Doc_Title,
      Ascending
   )
)

 

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.

View solution in original post

You are phenomenal!!! That worked, thank you so much. This has taken me way too long and I just couldn’t get it. I appreciate you.

Helper I
Helper I

@WarrenBelz I have one more thing on this , they want me to add to this bowl of crazy:

 

if a drop down field called “view” is changed to “My Documents “, the gallery changes to any document that has in its “doc_owner” column or “do_designee” column that has my name in (or whatever user is signed into the app) to show. Then there is a “all documents” in that dropdown which shows everything. Attached is what I have so far. 

@Km00 ,

Can you please post any code you have done in Text (as noted last post).

Thanks 

Helper I
Helper I

Sorry for the delay:  

 

I was able to do the following and it seems to be working okay:

 

 

With({
wDoc:cbDocSearch.Selected.Value,
wSearch:SearchDocTitle.Text,
wFromDate: DateFrom.SelectedDate,
wToDate: DateTo.SelectedDate,
wView: cbDocView.Selected.Value
},
Sort(
Filter(
Filter('New Item Only Action Log',
varView=false ||User().FullName in DO_Designee.DisplayName || User().FullName in Doc_Owner.DisplayName || cbDocView.Selected.Value="All Documents"),
Publication_Date >=DateFrom.SelectedDate &&
Publication_Date <= DateTo.SelectedDate &&
(
IsBlank(wSearch) ||IsBlank(wDoc) || IsBlank(wFromDate) || IsBlank(wToDate) ||
Switch(
wDoc,
"Document Title",
wSearch in Doc_Title,
"Document Owner",
wSearch in Doc_Owner_DisplayName,
"Document Owner Designee",
wSearch in DO_Designee_DisplayName,
"Document Owner's Team",
wSearch in SO_Dept_DisplayName
)
)
),
Doc_Title,
Ascending
)
)

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 (48,715)