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

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (1,639)