cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RockyRocks
Helper I
Helper I

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
yashag2255
Dual Super User II
Dual Super User II

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!

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.

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!

 
 
v-xida-msft
Community Support
Community Support

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.


@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,




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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (34,917)