cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Michall33
Regular Visitor

How to create unique search logic

Hello,

 

I am trying to link a Gallery, Search Text Box, and a Sort Icon, but I can get nothing to work together.  I have tried different combinations of logic and searched various sites but have not been able to get anything to work correctly.  

 

Here is my current status:

Sort Icon

OnSelect Formula = SortByColumns(Search('Project List',SearchEmployee.Text,"TeamMember","ProjectStatus","Projects","Title"),"TeamMember",If(SortDescending1,Descending,Ascending))

AccessibleLabel Formula = Self.Tooltip

 

SearchEmployee Text Box

OnChange = false

OnSelect = SortByColumns(Search('Project List',SearchEmployee.Text,"TeamMember","ProjectStatus","Projects","Title"),"TeamMember",If(SortDescending1,Descending,Ascending))

 

Project Gallery

OnSelect formula = Navigate(Project_Details,ScreenTransition.None)

Items formula = SortByColumns(Search('Project List',SearchEmployee.Text,"TeamMember","ProjectStatus","Projects","Title"),"TeamMember",If(SortDescending1,Descending,Ascending))

 

In the Project Gallery, once I overrode the SharePoint List name with the equation, all the lines of data disappeared.  I basically see the below which shows a warning for all three of the elements I am trying to link up.

 

Michall33_0-1601473190776.png

 

THanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions

@Michall33 

Yep...that will make a huge difference!!

 

Try this then:

DropColumns(
    SortByColumns(
        Search(
            AddColumns('Project List',
                "txtTeamMember", TeamMember.Value,
                "txtProjectStatus", ProjectStatus.Value,
                "txtKPI", KPI.Value
            ),
           SearchEmployee.Text,
           "txtTeamMember",
           "txtProjectStatus",
           "txtKPI",
           "Title"
        ),
        "txtTeamMember",
        If(SortOrder,Descending,Ascending)
    ),
    "txtTeamMember",
    "txtProjectStatus",
    "txtKPI"
)

 

You now mention KPI - before we had Projects...is that KPI?  Is that something that needs to be in the formula?  Not sure where that went from your response.

 

Anyway, the above converts the values of the choice columns into text columns (via add columns) and then searches on the text columns.  Finally, it drops the columns as to avoid any conflicts with other areas in your app.

 

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

13 REPLIES 13
RandyHayes
Super User
Super User

@Michall33 

Please consider changing your Formulas to the following.

 

Sort Icon

    OnSelect action formula:  UpdateContext({SortOrder:!SortOrder})

 

SearchEmployee TextInput

    Remove the formulas you currently have for OnSelect.

 

Project Gallery

    Items Formula:

    

SortByColumns(
    Search('Project List',
       SearchEmployee.Text,
       "TeamMember",
       "ProjectStatus",
       "Projects",
       "Title"
    ),
    "TeamMember",
    If(SortOrder,Descending,Ascending)
)

 

This should give you what you are looking for.

 

As for the warnings...yes, you are going to have delegation warnings because the Search function is not delegable. If your expecting to have over 2000 records in your data source, then consider alternative methods for searching.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thanks @RandyHayes.

 

This did solve two of the issues but the gallery is still not displaying the current list of items.  How can I get the search function to work and get the gallery of items to display?  Would really appreciate some guidance on this last point.

 

 

 

@Michall33 

No problem.

 

So, what are you seeing now?  You seem to indicate that nothing is showing?  Or am I missing something?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @RandyHayes ,

 

This is all that I see.  It looks like there is still an error and then no items are populating from the SharePoint List which it should be referencing.  Currently there are about 10 items in the list and none of them show.

 

2020-10-01_11-17-35.jpg

@Michall33 

You are always going to have the delegation warning because you are using the Search function - it is not delegable.

As for nothing showing...what is the Default property of your SearchEmployee control?

  

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @RandyHayes ,

 

The current default property is actually blank.  Could you guide me on the correct input for this section?  Also here is a couple other fields in the Advanced section.

2020-10-01_16-54-03.jpg

@Michall33 

I do not believe the image you posted is the SearchEmployee control properties.

I am concerned over the Default property of the TextInput control you have called "SearchEmployee"

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @RandyHayes ,

 

You are correct.  I did post the wrong section.  Here is the correct section.  Really appreciate your help!

 

2020-10-01_17-19-43.jpg

@Michall33 

No problem...always lots of moving parts!

 

That all looks good on the TextInput control.

 

So, the formula on your Gallery then still should be:

SortByColumns(
    Search('Project List',
       SearchEmployee.Text,
       "TeamMember",
       "ProjectStatus",
       "Projects",
       "Title"
    ),
    "TeamMember",
    If(SortOrder,Descending,Ascending)
)

 

Is this the formula you have now?  

If that is not working, then I would be suspect of the fields listed.

Consider taking out all but Title to test:

SortByColumns(
    Search('Project List',
       SearchEmployee.Text,
       "Title"
    ),
    "TeamMember",
    If(SortOrder,Descending,Ascending)
)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,125)