web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Help With a formula
Power Apps
Answered

Help With a formula

(0) ShareShare
ReportReport
Posted on by 105

I have a gallery and I need the following processes:

Gallery Items are restricted based on the role of the associate

I want the Gallery sorted

I Have a drop down filter and a client name search.

Everything works, but the search box

 

any suggestions

 

 

Sort(
Filter(
'DL2 - Validations and DQ -Submissions',
('Created By'.Email = varUserEmail)
|| ('Client Team Contact 1'.Email = varUserEmail)
|| ('Client Team Contact 2'.Email = varUserEmail)
|| ('Client Team Contact 3'.Email = varUserEmail)
|| ('Transformation Doer Offshore'.Email = varUserEmail)
|| ('Transformation Doer Onshore'.Email = varUserEmail)
|| ('Transformation TR Offshore'.Email = varUserEmail)
|| ('Transformation TR Onshore'.Email = varUserEmail)
|| (UserAdmin)
|| StartsWith('Client Name',txtSearch.Text)
&& ('Will the Data Level 2 Central Team implement the validations and data question or will the ongoing client team implement the validations and data question?'.Value = drpfilter.Selected.Value || drpfilter.Selected.Value = Blank())

),
'Client Name',
Ascending
)

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @nalstevens 

    Can you provide more details on what your search is (i.e. the name of the search text control), and what is not working about your formula?

    I can't tell if you are stating that the StartsWith is not working or that you want to put another level of Search into your formula.

     

  • nalstevens Profile Picture
    105 on at

    The Search is a text input label (txtSearch).  I want the associate to see only their items, but also be able to search by client.

    I used the Startswith to avoid delegation error.

  • nalstevens Profile Picture
    105 on at

    The Search is a text input label (txtSearch).  I want the associate to see only their items, but also be able to search by client.

    I used the Startswith to avoid delegation error.

  • nalstevens Profile Picture
    105 on at

    Sorry, what is not working is search input.  When I type in a client name, nothing filters

  • Verified answer
    sperry1625 Profile Picture
    765 Super User 2024 Season 1 on at

    I always find this to be a little clearer to read and understand, precedence is key with filters.

     

     

    Sort(
     Filter(
     'DL2 - Validations and DQ -Submissions',
     And(
     Or(
     'Created By'.Email = varUserEmail,
     'Client Team Contact 1'.Email = varUserEmail,
     'Client Team Contact 2'.Email = varUserEmail,
     'Client Team Contact 3'.Email = varUserEmail,
     'Transformation Doer Offshore'.Email = varUserEmail,
     'Transformation Doer Onshore'.Email = varUserEmail,
     'Transformation TR Offshore'.Email = varUserEmail,
     'Transformation TR Onshore'.Email = varUserEmail,
     UserAdmin,
     StartsWith( 'Client Name',txtSearch.Text )
     ),
     Or(
     'Will the Data Level 2 Central Team implement the validations and data question or will the ongoing client team implement the validations and data question?'.Value = drpfilter.Selected.Value,
     drpfilter.Selected.Value = Blank()
     )
     )
     ),
     "Client Name",
     Ascending
    )

     

    Is this your intended precedence?

     

    As this is written, if there is any email match or UserAdmin is true the value in the Client name is not relevant as it is OR'd with the rest of those filters.  If you always want to horo the search box and needs to be AND'd into the filter like below.

    Sort(
     Filter(
     'DL2 - Validations and DQ -Submissions',
     And(
     Or(
     'Created By'.Email = varUserEmail,
     'Client Team Contact 1'.Email = varUserEmail,
     'Client Team Contact 2'.Email = varUserEmail,
     'Client Team Contact 3'.Email = varUserEmail,
     'Transformation Doer Offshore'.Email = varUserEmail,
     'Transformation Doer Onshore'.Email = varUserEmail,
     'Transformation TR Offshore'.Email = varUserEmail,
     'Transformation TR Onshore'.Email = varUserEmail,
     UserAdmin
     ),
     Or(
     'Will the Data Level 2 Central Team implement the validations and data question or will the ongoing client team implement the validations and data question?'.Value = drpfilter.Selected.Value,
     drpfilter.Selected.Value = Blank()
     ),
     Or(
     StartsWith( 'Client Name',txtSearch.Text ).
     IsBlank( txtSearch.Text )
     )
     )
     ),
     "Client Name",
     Ascending
    )

     

    Regards,

    -S

    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.

  • nalstevens Profile Picture
    105 on at

    Thank you sperry1625 - you lead me down the correct path - just add an additional or statement to get to search to work

     

    Sort(
    Filter(
    'DL2 - Validations and DQ -Submissions',
    And(
    Or(
    'Created By'.Email = varUserEmail,
    'Client Team Contact 1'.Email = varUserEmail,
    'Client Team Contact 2'.Email = varUserEmail,
    'Client Team Contact 3'.Email = varUserEmail,
    'Transformation Doer Offshore'.Email = varUserEmail,
    'Transformation Doer Onshore'.Email = varUserEmail,
    'Transformation TR Offshore'.Email = varUserEmail,
    'Transformation TR Onshore'.Email = varUserEmail,
    UserAdmin),
    Or(
    StartsWith('Client Name and Data Process (must be unique for each data process of the client)',txtSearch.Text )
    ),
    Or(
    'Will the Data Level 2 Central Team implement the validations and data question or will the ongoing client team implement the validations and data question?'.Value = drpfilter.Selected.Value,
    drpfilter.Selected.Value = Blank()
    )
    )
    ),
    'Client Name and Data Process (must be unique for each data process of the client)',
    Ascending
    )

  • sperry1625 Profile Picture
    765 Super User 2024 Season 1 on at

    Don't forget to address a blank search box.

    Regards,

    -S

    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.

  • nalstevens Profile Picture
    105 on at

    I shot myself in the foot with the Or's.  The first statement should check if someone is a key member varUseremail. If they are, search and dropdown are available. I'm pulling my hair out. LOL it should not be this hard LOL 

    @sperry1625 any great wisdom to share

     

  • sperry1625 Profile Picture
    765 Super User 2024 Season 1 on at

    I always start by writing out my logic in plain terms.  Then converting to code.

     

    If I understand what you just said, only key members, that that match one of the records email entries, or is an admin, can use or apply the dropdown and search text.  Is my understanding correct?

     

    Assuming my assumption is correct, the first thing I would do I hide the dropdown and the search box if a user is NOT qualified to use them, or at a minimum disable them.

     

    The other question is whether the search text and the dropdown can be used together or separate.  I will assume separate for the moment.

     

    So Here is what my logic would look like with the above assumptions:

     

    Sort(
     Filter(
     'DL2 - Validations and DQ -Submissions',
     And(
     Or( // Is the user "special"? If this results in a False, nothing else will matter. Since
     // the three Or() sections are wrapped in an And() each Or() section must result in a
     // true in order for there to be a match.
     'Created By'.Email = varUserEmail,
     'Client Team Contact 1'.Email = varUserEmail,
     'Client Team Contact 2'.Email = varUserEmail,
     'Client Team Contact 3'.Email = varUserEmail,
     'Transformation Doer Offshore'.Email = varUserEmail,
     'Transformation Doer Onshore'.Email = varUserEmail,
     'Transformation TR Offshore'.Email = varUserEmail,
     'Transformation TR Onshore'.Email = varUserEmail,
     UserAdmin
     ), 
     Or( // Only if the user is "special" does this even matter.
     'Will the Data Level 2 Central Team implement the validations and data question or will the ongoing client team implement the validations and data question?'.Value = drpfilter.Selected.Value,
     IsBlank( drpfilter.Selected )
     ),
     Or( // Only if the user is "special" does this even matter.
     StartsWith( 'Client Name', txtSearch.Text ),
     IsBlank( txtSearch.Text ) // ** Important ** User may not enter search text and it should not throw off the results.
     )
     )
     ),
     "Client Name",
     Ascending
    )

     

    That should get the results you are looking for based on the assumptions made.

     

    If the dropdown and search text are to be used together the filter changes slightly to the following:

    Sort(
     Filter(
     'DL2 - Validations and DQ -Submissions',
     And(
     Or( // Is the user "special"? If this results in a False, nothing else will matter. Since
     // the three Or() sections are wrapped in an And() each Or() section must result in a
     // true in order for there to be a match.
     'Created By'.Email = varUserEmail,
     'Client Team Contact 1'.Email = varUserEmail,
     'Client Team Contact 2'.Email = varUserEmail,
     'Client Team Contact 3'.Email = varUserEmail,
     'Transformation Doer Offshore'.Email = varUserEmail,
     'Transformation Doer Onshore'.Email = varUserEmail,
     'Transformation TR Offshore'.Email = varUserEmail,
     'Transformation TR Onshore'.Email = varUserEmail,
     UserAdmin
     ),
     And( // If the dropdown and search text are to be used together.
     Or( // Only if the user is "special" does this even matter.
     'Will the Data Level 2 Central Team implement the validations and data question or will the ongoing client team implement the validations and data question?'.Value = drpfilter.Selected.Value,
     IsBlank( drpfilter.Selected )
     ),
     Or( // Only if the user is "special" does this even matter.
     StartsWith( 'Client Name', txtSearch.Text ),
     IsBlank( txtSearch.Text ) // ** Important ** User may not enter search text and it should not throw off the results.
     )
     )
     )
     ),
     "Client Name",
     Ascending
    )

     

    I hope this provides some clarity.  If my assumptions were incorrect please provide the logic rules of how you would like the match to work and I will give it another go.

     

    Regards,

    -S

    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.

  • nalstevens Profile Picture
    105 on at

    It is a large confidential list. I want the special users to see only the clients they are assigned to in the gallery. But, they can have over 100 clients so I would also like them to be able to search or filter for a single client from their assigned clients.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 316 Most Valuable Professional

#2
11manish Profile Picture

11manish 242

#3
Valantis Profile Picture

Valantis 198

Last 30 days Overall leaderboard