cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Sorting and avoiding <> delegation in PowerApps gallery

Hey All,

 

Hope you are all doing good.

 

I am working on a creating matching application in PowerApps where I am using SharePoint List as my backend dataset.

I have created a dropdown "SelectInvidividual" which pulls all the records from the SharePoint list by using "Name" column.  Selecting any value in this dropdown will populate a View Form "IndividualDetails" and also populates gallery list "MatchingGallery". In the Gallery, all folks in the SharePoint data set are displayed EXCEPT the one selected in dropdown. To do this I am using Name <> DataCardValue13.Text (DataCardValue13.Text is part of IndividualDetails view form). When I try to do this I am getting delegation warning of beyond 2000 records dataset might not get you correct results. Is there a different way I can avoid this and still achieve the desired output??

 

Next question.

After populating the Gallery (MatchingGallery), I am using a ton of formulas to arrive at a number for each individual. This number varies from 0 to 100 and is being displayed in a label. This value being calculated is dynamic based on selection done in dropdown "SelectInvidividual" and not stored in backend SharePoint dataset. Is there a way I can sort the Gallery based on this calculated value? Right now I am sorting alphabetically but that is giving me hapazard sort results when I compare the calculated value. For e.g. 1st Name -  43, 2nd Name -29, 3rd name - 86, 4th name - 11 and so on.

 

Any help is highly appreciated.

 

Thanks,

AKB

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @Anonymous ,

 

Sorry, I should have reminded you earlier that the SharePoint ID field for a table is a number field in Power Apps. However, SharePoint only supports the equal ('=') operation for delegation on an ID field.

Reference: https://docs.microsoft.com/en-us/connectors/sharepointonline/#power-apps-delegable-functions-and-operations-for-sharepoint 

You need to try with a Custom Number Column.

 

To the second question, could you please share more details with some codes and screenshots?

How do you define the FinalScoreValue? Please share us how is the value calculated?

Sik

View solution in original post

Hi @Anonymous ,

 

It is not supported to sort gallery by the inside label value directly, it can only be sort by the data in the backend source.\

As an alternative workaround, you can create a new gallery, set items source to potentialEmployeeGallery.AllItems to take all gallery items as backend source of new gallery, then you are able to sort it by lblFinalValue.

Set new Gallery.Items property:

Sort(potentialEmployeeGallery.AllItems,lblFinalValue.Text,Descending)

Snipaste_2020-05-19_10-35-24.png

Hope this helps,

Sik

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

I have now updated my App code to pull the entire SharePoint list dataset as a collection using ClearCollect method and remapped all the galleries and forms to point to this collection. The delegation warning is gone but my query is will this give accurate filter results for records count >2000. I am expecting minimum of 300-400 entries to SharePoint list per week once I go live with this app. 

 

Hi @Anonymous ,

 

No, It is not a perfect resolution to collects data to local collection, since ClearCollect is not a delegable function, so it can only collect 2000 records from the SharePoint list.

'<>' operator is only delegable for Number column in SharePoint list, so my workaround is to filter the gallery based on the Number column value of corresponding selected record from dropdown.

1. add a Number type column which should be unique identifier to SharePoint list,

2. save the Number value of selected Name record to variable when select the dropdown.

DropDown.OnChange: Set(MyVar,LookUp('SP list',Name=Dropdown1.Selected.Name).NumberColumn)

3. filter the gallery based on that variable(Number value).

Gallery.Items: Filter('SP list', NumberColumn<>MyVar)

 

To your second question, I think you use AddColumns function to add a new column to store the calculated number in Gallery.Items property, then you can sort the gallery based on that new column.

Hope this helps.
Sik

Anonymous
Not applicable

Thanks for responding @v-siky-msft . 

 

I tried the number trick you suggested but it is also showcasing delegation warning.

This is the code I entered:

Items: Sort(ShowColumns(Survey,"Name", "ID"),Name,Ascending)

ID is the number column which is automatically generated in SharePoint list.

On change property: Set(selectionID,Value(LookUp(Survey,Name=NameSelect.Selected.Name).ID))

selectionID is my number variable

 

Gallery Items formula:

Filter(
Survey,
ID <> selectionID,
other filters

)

 

Let me know if you require any additional details?

 

On the AddColumns function, I had tried it out but I was getting circular reference error. Below highlighted is where I am getting the circular reference error.

Sort(AddColumns(Survey,"Score",FinalScoreValue),"Score",Ascending)

 

All calculations adding up to FinalScoreValue is calculated dynamically for each item being displayed in the gallery

 

Thanks,

AKB

Hi @Anonymous ,

 

Sorry, I should have reminded you earlier that the SharePoint ID field for a table is a number field in Power Apps. However, SharePoint only supports the equal ('=') operation for delegation on an ID field.

Reference: https://docs.microsoft.com/en-us/connectors/sharepointonline/#power-apps-delegable-functions-and-operations-for-sharepoint 

You need to try with a Custom Number Column.

 

To the second question, could you please share more details with some codes and screenshots?

How do you define the FinalScoreValue? Please share us how is the value calculated?

Sik

Anonymous
Not applicable

Hey there again @v-siky-msft,

 

So the suggestion of creating a new dynamic number column worked. I used FLOW to populate the newly created number column with ID value and delegation warnings have now gone away! Thanks so much for that 👍

 

For the circular reference error, the scenario is something like this.

Based on the dropdown selection value (on which I was getting delegation error), let's call this "A", I am populating the gallery details by displaying data of SharePoint list rows but filtering the one selected in dropdown. There is multiple selection checkbox column in SharePoint which is based on 15 different records.  As it is multiple selection checkbox value, I am first converting the value using CONCAT condition into a label and then searching the 15 items in the new label individually using IN function. Each find gives user a value of 1 and not selected gives them value 0. Total value of each row is thus dynamically calculated to get a "Value B" out of total 15 which I am calculating using SUM and VALUE(label.text) function.

 

Now the same process is followed for the dropdown selection and based on which "VALUE A" is calculated.

 

Calculation done for each gallery row = (Value B/Value A) * 100 --> Lets call this Value C

 

Now when I try to sort the gallery items based on Value C, I am getting circular reference error. Let me know if you require any additional info.

 

 

Hi @Anonymous ,

 

Are there any screenshots and codes? It can help us understand.

In general, you should first to save the calculated value to a new column by AddColumns function and generate a new Collection, then sort on the new collection based on that calculated column.

Please step by step, generate a new collection and then sort it in Gallery.Items property.

Hope this helps.

Sik

Anonymous
Not applicable

Sorry @v-siky-msft for not replying earlier as I got caught up in other stuff.

 

This is how the formulas work

I select employee details in dropdown 1. It filters the value from sharepoint list. Formula -  Sort(ShowColumns(Survey,"Name", "ID"),Name,Ascending)

Untitled.png

Each employee has filled up a multiple choice survey questionnaire. These multiple choice answers are used to get the calculate value in vertical gallery also displayed from the same SharePoint list.

To convert multiple choice into a label inside gallery I am using following formula

lblTopicsSelected - Concat(ThisItem.TopicsSelected.Value,Concatenate(Text(Value),""))

 

As there are 18 multiple choice options, I am using following formula to calculate if any of the following value is present

lblItem1 = If("ABC" in lblTopicsSelected .Text,1,0)

lblItem2 = If("DEF" in lblTopicsSelected .Text,1,0)

lblItem3 = If("GHI" in lblTopicsSelected .Text,1,0)

.

.

.

lblItem16 = If("XYZ" in lblTopicsSelected .Text,1,0)

 

I am calculating the sum of these individual lblItems by using

lblTotalSum = Sum(Value(lblItem1.Text), Value(lblItem2.Text),..........,Value(lblItem16.Text)

 

From employeedropdown selection, I am calculating a similar value (not inside gallery) lblTotalEmployeeValue

 

Now the final matching value is calculated as in another label.

lblFinalValue = (Value(lblTotalSum.Text)/Value(lblTotalEmployeeValue.Text)) *100. This is calculated for each gallery row. I want to sort the gallery based on this lblFinalValue being displayed but getting circular reference error.

Hi @Anonymous ,

 

It is not supported to sort gallery by the inside label value directly, it can only be sort by the data in the backend source.\

As an alternative workaround, you can create a new gallery, set items source to potentialEmployeeGallery.AllItems to take all gallery items as backend source of new gallery, then you are able to sort it by lblFinalValue.

Set new Gallery.Items property:

Sort(potentialEmployeeGallery.AllItems,lblFinalValue.Text,Descending)

Snipaste_2020-05-19_10-35-24.png

Hope this helps,

Sik

Anonymous
Not applicable

Thanks for the tip @v-siky-msft. Worked great.

 

Only change which I did was instead of Sort(Gallery1.AllItems,Label1.Text,Descending) I used  Sort(Gallery1.AllItems,Value(Label1.Text),Descending)

 

Cheers!

Helpful resources

Announcements

April 2024 Community Newsletter

We're pleased to share the April Community Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members.   If you're new to the Community, please make sure to follow the latest News & Announcements and check out the Community on LinkedIn as well! It's the best way to stay up-to-date with all the news from across Microsoft Power Platform and beyond.    COMMUNITY HIGHLIGHTS   Check out the most active community members of the last month! These hardworking members are posting regularly, answering questions, kudos, and providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, follow these awesome community members to see what they do!   Power AppsPower AutomateCopilot StudioPower PagesWarrenBelzDeenujialexander2523ragavanrajanLaurensMManishSolankiMattJimisonLucas001AmikcapuanodanilostephenrobertOliverRodriguestimlAndrewJManikandanSFubarmmbr1606VishnuReddy1997theMacResolutionsVishalJhaveriVictorIvanidzejsrandhawahagrua33ikExpiscornovusFGuerrero1PowerAddictgulshankhuranaANBExpiscornovusprathyooSpongYeNived_Nambiardeeksha15795apangelesGochixgrantjenkinsvasu24Mfon   LATEST NEWS Business Applications Launch Event - On Demand In case you missed the Business Applications Launch Event, you can now catch up on all the announcements and watch the entire event on-demand inside Charles Lamanna's latest cloud blog.   This is your one stop shop for all the latest Copilot features across Power Platform and #Dynamics365, including first-hand looks at how companies such as Lenovo, Sonepar, Ford Motor Company, Omnicom and more are using these new capabilities in transformative ways. Click the image below to watch today!     Power Platform Community Conference 2024 is here! It's time to look forward to the next installment of the Power Platform Community Conference, which takes place this year on 18-20th September 2024 at the MGM Grand in Las Vegas!   Come and be inspired by Microsoft senior thought leaders and the engineers behind the #PowerPlatform, with Charles Lamanna, Sangya Singh, Ryan Cunningham, Kim Manis, Nirav Shah, Omar Aftab and Leon Welicki already confirmed to speak. You'll also be able to learn from industry experts and Microsoft MVPs who are dedicated to bridging the gap between humanity and technology. These include the likes of Lisa Crosbie, Victor Dantas, Kristine Kolodziejski, David Yack, Daniel Christian, Miguel Félix, and Mats Necker, with many more to be announced over the coming weeks.   Click here to watch our brand-new sizzle reel for #PPCC24 or click the image below to find out more about registration. See you in Vegas!     Power Up Program Announces New Video-Based Learning Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram. These include a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the image below to find out more!     UPCOMING EVENTS Microsoft Build - Seattle and Online - 21-23rd May 2024 Taking place on 21-23rd May 2024 both online and in Seattle, this is the perfect event to learn more about low code development, creating copilots, cloud platforms, and so much more to help you unleash the power of AI.   There's a serious wealth of talent speaking across the three days, including the likes of Satya Nadella, Amanda K. Silver, Scott Guthrie, Sarah Bird, Charles Lamanna, Miti J., Kevin Scott, Asha Sharma, Rajesh Jha, Arun Ulag, Clay Wesener, and many more.   And don't worry if you can't make it to Seattle, the event will be online and totally free to join. Click the image below to register for #MSBuild today!     European Collab Summit - Germany - 14-16th May 2024 The clock is counting down to the amazing European Collaboration Summit, which takes place in Germany May 14-16, 2024. #CollabSummit2024 is designed to provide cutting-edge insights and best practices into Power Platform, Microsoft 365, Teams, Viva, and so much more. There's a whole host of experts speakers across the three-day event, including the likes of Vesa Juvonen, Laurie Pottmeyer, Dan Holme, Mark Kashman, Dona Sarkar, Gavin Barron, Emily Mancini, Martina Grom, Ahmad Najjar, Liz Sundet, Nikki Chapple, Sara Fennah, Seb Matthews, Tobias Martin, Zoe Wilson, Fabian Williams, and many more.   Click the image below to find out more about #ECS2024 and register today!   Microsoft 365 & Power Platform Conference - Seattle - 3-7th June If you're looking to turbo boost your Power Platform skills this year, why not take a look at everything TechCon365 has to offer at the Seattle Convention Center on June 3-7, 2024.   This amazing 3-day conference (with 2 optional days of workshops) offers over 130 sessions across multiple tracks, alongside 25 workshops presented by Power Platform, Microsoft 365, Microsoft Teams, Viva, Azure, Copilot and AI experts. There's a great array of speakers, including the likes of Nirav Shah, Naomi Moneypenny, Jason Himmelstein, Heather Cook, Karuana Gatimu, Mark Kashman, Michelle Gilbert, Taiki Y., Kristi K., Nate Chamberlain, Julie Koesmarno, Daniel Glenn, Sarah Haase, Marc Windle, Amit Vasu, Joanne C Klein, Agnes Molnar, and many more.   Click the image below for more #Techcon365 intel and register today!   For more events, click the image below to visit the Microsoft Community Days website.    

Tuesday Tip | Update Your Community Profile Today!

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   We're excited to announce that updating your community profile has never been easier! Keeping your profile up to date is essential for staying connected and engaged with the community.   Check out the following Support Articles with these topics: Accessing Your Community ProfileRetrieving Your Profile URLUpdating Your Community Profile Time ZoneChanging Your Community Profile Picture (Avatar)Setting Your Date Display Preferences Click on your community link for more information: Power Apps, Power Automate, Power Pages, Copilot Studio   Thank you for being an active part of our community. Your contributions make a difference! Best Regards, The Community Management Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Tuesday Tip: Community User Groups

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: Community User Groups and YOU Being part of, starting, or leading a User Group can have many great benefits for our community members who want to learn, share, and connect with others who are interested in the Microsoft Power Platform and the low-code revolution.   When you are part of a User Group, you discover amazing connections, learn incredible things, and build your skills. Some User Groups work in the virtual space, but many meet in physical locations, meaning you have several options when it comes to building community with people who are learning and growing together!   Some of the benefits of our Community User Groups are: Network with like-minded peers and product experts, and get in front of potential employers and clients.Learn from industry experts and influencers and make your own solutions more successful.Access exclusive community space, resources, tools, and support from Microsoft.Collaborate on projects, share best practices, and empower each other. These are just a few of the reasons why our community members love their User Groups. Don't wait. Get involved with (or maybe even start) a User Group today--just follow the tips below to get started.For current or new User Group leaders, all the information you need is here: User Group Leader Get Started GuideOnce you've kicked off your User Group, find the resources you need:  Community User Group ExperienceHave questions about our Community User Groups? Let us know! We are here to help you!

Super User of the Month | Ahmed Salih

We're thrilled to announce that Ahmed Salih is our Super User of the Month for April 2024. Ahmed has been one of our most active Super Users this year--in fact, he kicked off the year in our Community with this great video reminder of why being a Super User has been so important to him!   Ahmed is the Senior Power Platform Architect at Saint Jude's Children's Research Hospital in Memphis. He's been a Super User for two seasons and is also a Microsoft MVP! He's celebrating his 3rd year being active in the Community--and he's received more than 500 kudos while authoring nearly 300 solutions. Ahmed's contributions to the Super User in Training program has been invaluable, with his most recent session with SUIT highlighting an incredible amount of best practices and tips that have helped him achieve his success.   Ahmed's infectious enthusiasm and boundless energy are a key reason why so many Community members appreciate how he brings his personality--and expertise--to every interaction. With all the solutions he provides, his willingness to help the Community learn more about Power Platform, and his sheer joy in life, we are pleased to celebrate Ahmed and all his contributions! You can find him in the Community and on LinkedIn. Congratulations, Ahmed--thank you for being a SUPER user!  

Tuesday Tip: Getting Started with Private Messages & Macros

Welcome to TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   This Week's Tip: Private Messaging & Macros in Power Apps Community   Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member!   Our Knowledge Base article about private messaging and macros is the best place to find out more. Check it out today and discover some key tips and tricks when it comes to messages and macros:   Private Messaging: Learn how to enable private messages in your community profile and ensure you’re connected with other community membersMacros Explained: Discover the convenience of macros—prewritten text snippets that save time when posting in forums or sending private messagesCreating Macros: Follow simple steps to create your own macros for efficient communication within the Power Apps CommunityUsage Guide: Understand how to apply macros in posts and private messages, enhancing your interaction with the Community For detailed instructions and more information, visit the full page in your community today:Power Apps: Enabling Private Messaging & How to Use Macros (Power Apps)Power Automate: Enabling Private Messaging & How to Use Macros (Power Automate)  Copilot Studio: Enabling Private Messaging &How to Use Macros (Copilot Studio) Power Pages: Enabling Private Messaging & How to Use Macros (Power Pages)

Top Solution Authors
Top Kudoed Authors
Users online (7,623)