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

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Compare and Sort/filter values in the gallery

(0) ShareShare
ReportReport
Posted on by 559

Hi All, 

I have a combo box(prjnames_3) which loads all the Projects from the SharePoint list. Below that I have a Practice label which loads when the value in the combo box is selected. It changes based on the Project selected. I have a gallery which sorts the Phases from a SharePoint list based on the Practice displayed.

This code gets the Practice from a list based on the Project names selected in the Combo box.

Set(varPractice ,LookUp(ProjectMaster_List,ProjectName = prjnames_3.Selected. Project Name, Practice.Value));

This code gets all the Phase names with respect to the Practice and compares with the varPractice where it is there above.

Clear(PracticeCollection);Collect(PracticeCollection, 'Practice Master');Clear(PhaseNameCollection);Collect(PhaseNameCollection,
Filter(Ungroup(ShowColumns(PracticeCollection,"Practice","PhaseName"),"PhaseName"),
!IsBlank(PracticeCollection)));
ForAll(
PhaseNameCollection,
If(
varPractice = Practice,
Collect(
Phasenames,
{id: Id,Phase: Value})));

All the above code is written on the On change property of the Combo box. so when Project is selected it will the get practice names which in turn gets the related Phase names and it must display the Phases values in the gallery.

 

The code on the items gallery is:

Distinct(Phasenames, Phase)

but the values in the gallery are not displaying properly based on the Practice instead displaying all the Phase values and filtering is not proper.

Any idea/suggestion on this.

Categories:
I have the same question (0)
  • Verified answer
    v-jefferni Profile Picture
    on at
    Re: Compare and Sort/filter values in the gallery

    Hi @Uthhra ,

     

    The formulas that get phases OnChange of Combo box seem wrong. Please try below formulas instead:

    ClearCollect(PracticeCollection, 'Practice Master');
    ClearCollect(PhaseNameCollection,Ungroup(ShowColumns(PracticeCollection,"Practice","PhaseName"),"PhaseName"));
    ClearCollect(Phasenames,ForAll(PhaseNameCollection,If(varPractice = Practice,{id: Id,Phase: Value})));

     

    Best regards,

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

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 803 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 314 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 253 Super User 2025 Season 2

Last 30 days Overall leaderboard