cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RockyRocks
Level: Powered On

Powerapps sort gallery and inner gallery by between dates

Hi team,

I am new to powerapps any help will be thankful.

I have below data in sharepoint

Name education datecreated sequenceID
Rock btech 04/06/2019 seq-001
John degree 04/06/2019 seq-002
Batis degree 04/06/2019 seq-002
Triple btech 05/06/2019 seq-003
....... So on


So here I want to display above data in below
1.Sort by date selected between 2 date pickers
2 Sort by sequenceID as each day we will have multiple sequence ID and display them

List: Empdetails
StartDatepicker, Enddatepicker, button
Gallery 1,gallery2

How to solve this, I have took parent gallery to sort by date based on datepickers between 2 dates

In inner gallery how to sort by respective sequenceID and show other fields for that sequenceID like name, education

I just need to display all the details in gallery with sequence format based on the between dates selected and click of button

Thanks in advance for any solution.
6 REPLIES 6
Super User
Super User

Re: Powerapps sort gallery and inner gallery by between dates

Hi @RockyRocks 

 

I tried to replicate your scenario in my environment and I am able to get the results by following below mentioned steps:
 
1) You need to do a GroupBy in the Gallery1 items so all the records in a specific date, is considered as one record.
Expression:
Gallery1 -> Items -> Sort(GroupBy(Filter(MyTestList12,datecreated >= DatePicker1.SelectedDate && datecreated <= DatePicker2.SelectedDate),"datecreated","Grouped"),datecreated,Ascending)
2) Now for the Inner Gallery, please use the below expression:
Expression: 
Gallery2 -> Items -> Sort(ThisItem.Grouped,sequenceID,Ascending)
Here, DatePicker1 and DatePicker2 are my Start and End Date filters.MicrosoftTeams-image (139).png

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
RockyRocks
Level: Powered On

Re: Powerapps sort gallery and inner gallery by between dates

Hi @yashag

Thanks for reply,

The result I require is, I need it to sort by sequenceID aswell and display them as you shown for date.( not sure if it is possible, might be we need to use triple gallery?)


If above is not possible

Can we have an dropdown in gallery1 so that for that date all the sequenceID will be in shown in dropdown and filter gallery2 based on dropdown selected value but by default we need to show all the details.
Super User
Super User

Re: Powerapps sort gallery and inner gallery by between dates

HI @RockyRocks 

 

The second gallery is already sorted on the basis of SequenceID. If you want to categorize them on the basis of SequenceID as well. You need to create a dropdown like you mentioned in your previous reply. You cannot have three nested galleries in PowerApps.
Please follow below expressions:
Dropdown Items: 
Sort(Distinct(ThisItem.Grouped,sequenceID),Result,Ascending)
Gallery1 Items: 
Sort(GroupBy(Filter(MyTestList12,datecreated >= DatePicker1.SelectedDate && datecreated <= DatePicker2.SelectedDate),"datecreated","Grouped"),datecreated,Ascending)
Gallery2 Items: 
Sort(Filter(ThisItem.Grouped,sequenceID = Dropdown1.Selected.Result),sequenceID,Ascending)MicrosoftTeams-image (140).png

 

Hope this Helps!

 
 
Community Support Team
Community Support Team

Re: Powerapps sort gallery and inner gallery by between dates

Hi @RockyRocks ,

Based on the needs that you mentioned, I think the GroupBy function could achieve your needs. I have made a test on my side, please take a try with the following workaround:

Set the Items property of the Gallery1 to following formula:

GroupBy(
SortByColumns(
Filter(
Empdetails,
datecreated >= StartDatepicker.SelectedDate && datecreated <= Enddatepicker.SelectedDate
),
"datecreated",
Descending
),
"datecreated",
"GroupData"
)

Within the Gallery1, add a Label, set the Text property to following:

ThisItem.datecreated

Set the Items property of the Gallery2 within the Gallery1 to following:

SortByColumns(
Filter( Empdetails,
datecreated = ThisItem.datecreated ),
"sequenceID",
Descending
)

Add two Labels within your Gallery2, set the Text property to following:

ThisItem.Name
ThisItem.education

 

If you want to add a Dropdown box within the Gallery1 to list all available sequenceID values, then based on the selected sequenceID value to filter your Gallery2 Items (In default, display all records within the Gallery2). Please take a try with the following workaround:

Add a ComboBox control (ComboBox1) within the Gallery1, set the Items property to following:

Filter(
        Empdetails,
datecreated = ThisItem.datecreated ).sequenceID

Set the SelectMultiple property of the ComboBox to following:

false

Set the Items property of the Gallery2 to following:

Filter(
       Empdetails,
If(
IsEmpty(ComboBox1.SelectedItems), /* <-- Check if you have selected a value within the Combobox */
true,
sequenceID = ComboBox1.Selected.sequenceID
) )

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
RockyRocks
Level: Powered On

Re: Powerapps sort gallery and inner gallery by between dates


@v-xida-msft wrote:

Hi @RockyRocks ,

Based on the needs that you mentioned, I think the GroupBy function could achieve your needs. I have made a test on my side, please take a try with the following workaround:

Set the Items property of the Gallery1 to following formula:

GroupBy(
SortByColumns(
Filter(
Empdetails,
datecreated >= StartDatepicker.SelectedDate && datecreated <= Enddatepicker.SelectedDate
),
"datecreated",
Descending
),
"datecreated",
"GroupData"
)

Within the Gallery1, add a Label, set the Text property to following:

ThisItem.datecreated

Set the Items property of the Gallery2 within the Gallery1 to following:

SortByColumns(
Filter( Empdetails,
datecreated = ThisItem.datecreated ),
"sequenceID",
Descending
)

Add two Labels within your Gallery2, set the Text property to following:

ThisItem.Name
ThisItem.education

 

If you want to add a Dropdown box within the Gallery1 to list all available sequenceID values, then based on the selected sequenceID value to filter your Gallery2 Items (In default, display all records within the Gallery2). Please take a try with the following workaround:

Add a ComboBox control (ComboBox1) within the Gallery1, set the Items property to following:

Filter(
        Empdetails,
datecreated = ThisItem.datecreated ).sequenceID

Set the SelectMultiple property of the ComboBox to following:

false

Set the Items property of the Gallery2 to following:

Filter(
       Empdetails,
If(
IsEmpty(ComboBox1.SelectedItems), /* <-- Check if you have selected a value within the Combobox */
true,
sequenceID = ComboBox1.Selected.sequenceID
) )

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,




RockyRocks
Level: Powered On

Re: Powerapps sort gallery and inner gallery by between dates

Thanks a lot @

 

The inner gallery is not fetching data above 2000th rown from sharepoint am getting blank displayed, But the Upper gallery its fetching correctly, what can be done?

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 256 members 4,989 guests
Please welcome our newest community members: