cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
abd3127
Kudo Kingpin
Kudo Kingpin

Showing data in a gallery when two different lists have same data

Hi Team,

In my app, i have a situation where i want to show data in gallery when two different lists have the same number of data.

 

Scenario:

1.First list "Budget" contains TeamLeadName, Amount, Status columns.

2.Second list "Updated Budget" contains TeamLeadName, ExtraAmount, Status

 

Now when a particular person(Admin) logs into my app, i want to count the requests in "Budget"(First List) those have Distinct TeamLeadName, Approved Requests (Say 4). And if the same number of requests (Say 4) are logged in "Updated Budget" (Second List), Then i want to show these requests from "Updated Budget" (Second List) in a gallery to the Admin. 

 

Any suggestion will be helpful!!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @abd3127,

Just an update -- Please take a try with the following workaround:

Set the OnVisible property of the first screen of your app to following formula:

Clear(RecordsCollection);
ForAll(
      RenameColumns(
GroupBy(AddColumns(Filter('Budget',Status.Value="Approved"),"StatusValue", Status.Value),"TeamLeadName","StatusValue","GroupData"),
"TeamLeadName", "TeamLeadName1"
), If( CountRows(GroupData) = CountRows(Filter('Updated Budget', TeamLeadName = TeamLeadName1, Status.Value = "Approved")), Collect(RecordsCollection, Filter('Updated Budget', TeamLeadName = TeamLeadName1, Status.Value = "Approved")) ) )

Set the Items property of the Gallery control to following:

RecordsCollection

Best regards,

Kris

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.

View solution in original post

5 REPLIES 5
v-xida-msft
Community Support
Community Support

Hi @abd3127,

Could you please share a bit more about the Status column in your two SP lists? Is it a Choice type column?

Do you want to display the same approved request (Say 4) from "Updated Budget" in a Gallery?

Further, could you please share more details about the "same number of requests" that you mentioned?

I suppose that the Status column is a Choice type column, is it true?

If you just want to display the same approved requests (Say 4) from "Updated Budget" in a Gallery, I have made a test on my side, please take a try with the following workaround:6.JPG

 

7.JPG

Set the OnVisible property of the first screen of my app to following:

Clear(RecordsCollection);
ForAll(
    RenameColumns(GroupBy(AddColumns(Filter('20181227_case3', Status.Value="Approved"),"StatusValue", Status.Value),"TeamLeadName","StatusValue","GroupData"), "TeamLeadName","TeamLeadName1"),
    If(
        !IsBlank(LookUp('20181227_case3_1',TeamLeadName = TeamLeadName1 && Status.Value="Approved")),
        Collect(RecordsCollection, LookUp('20181227_case3_1',TeamLeadName=TeamLeadName1 && Status.Value="Approved"))
    )
)

On your side, you should type:

Clear(RecordsCollection);
ForAll(
    RenameColumns(GroupBy(AddColumns(Filter('Budget', Status.Value="Approved"), "StatusValue", Status.Value),"TeamLeadName","StatusValue","GroupData"), "TeamLeadName","TeamLeadName1"),
    If(
        !IsBlank(LookUp('Updated Budget',TeamLeadName=TeamLeadName1 && Status.Value = "Approved")),
        Collect(RecordsCollection, LookUp('Updated Budget',TeamLeadName = TeamLeadName1 && Status.Value="Approved"))
    )
)

Set the Items property of the Gallery to following:

RecordsCollection

 

If you want to display the approved requests (Say 4) from your "Updated Budget" (Second List) in a gallery only when the same number of requests (Say 4) are existed in your "Updated Budget" list, I have made a test, please take a try with the following workaround:

Set the Items property of the Gallery to following:

If(
CountRows(GroupBy(AddColumns(Filter('20181227_case3',Status.Value="Approved"),"StatusValue", Status.Value),"TeamLeadName","StatusValue","GroupData")) = CountRows(GroupBy(AddColumns(Filter('20181227_case3_1',Status.Value="Approved"),"StatusValue", Status.Value),"TeamLeadName","StatusValue","GroupData")),
GroupBy(AddColumns('20181227_case3_1',"StatusValue", Status.Value),"TeamLeadName","StatusValue","GroupData")
)

On your side, you should type:

If(
   CountRows(
GroupBy(AddColumns(Filter('Budget',Status.Value="Approved"),"StatusValue", Status.Value),"TeamLeadName","StatusValue","GroupData")
) =
CountRows(
GroupBy(AddColumns(Filter('Updated Budget',Status.Value="Approved"),"StatusValue", Status.Value),"TeamLeadName","StatusValue","GroupData")
), GroupBy(AddColumns('Updated Budget',"StatusValue", Status.Value),"TeamLeadName","StatusValue","GroupData") )

Best regards,

Kris

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.

Thanks @v-xida-msft

This solution perfectly works for my scenario. The only change was that "TeamLeadName" was a person field and needed to be included in add columns,

Now the formula that you gave to display data in gallery 

If(
   CountRows(
         GroupBy(AddColumns(Filter('Budget',Status.Value="Approved"),"StatusValue", Status.Value),"TeamLeadName","StatusValue","GroupData")
    ) = 
   CountRows(
         GroupBy(AddColumns(Filter('Updated Budget',Status.Value="Approved"),"StatusValue", Status.Value),"TeamLeadName","StatusValue","GroupData")
   ), 
   GroupBy(AddColumns('Updated Budget',"StatusValue", Status.Value),"TeamLeadName","StatusValue","GroupData")
)

 Shows data in grouped state and not the separate requests. I need to show the separate requests here according to the approved status.

Can you suggest any ideas for this?

Hi @abd3127,

Could you please share a bit more about the "Separate request" that you mentioned?

Do you want to only display the approved request from your 'Updated Budget' list?

If you only want to display the approved request (rather than Groupded state) from your 'Updated Budget' list, please modify your formula as below:

If(
   CountRows(
         GroupBy(AddColumns(Filter('Budget',Status.Value="Approved"),"StatusValue", Status.Value),"TeamLeadName","StatusValue","GroupData")
    ) = 
   CountRows(
         GroupBy(AddColumns(Filter('Updated Budget',Status.Value="Approved"),"StatusValue", Status.Value),"TeamLeadName","StatusValue","GroupData")
   ), 
   Filter('Updated Budget', Status.Value = "Approved") /* <- Modify here */
)

Best regards,

Kris

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.

Hi @v-xida-msft

Yes i want to show the approved requests here.

The "separate Requests" that i mentioned are the different requests for each TeamLead in UpdatedBudget , Budget Lists.

The scenario which i want here is like "TeamLead1" has 4 requests in Budget and UpdatedBudget. Then i need to show these 4 requests in a gallery.

"TeamLead2" has 4 requests in Budget and 2 requests in UpdatedBudget, then i dont want to display these requests even if they are approved in both lists.

 

Thanks

Hi @abd3127,

Just an update -- Please take a try with the following workaround:

Set the OnVisible property of the first screen of your app to following formula:

Clear(RecordsCollection);
ForAll(
      RenameColumns(
GroupBy(AddColumns(Filter('Budget',Status.Value="Approved"),"StatusValue", Status.Value),"TeamLeadName","StatusValue","GroupData"),
"TeamLeadName", "TeamLeadName1"
), If( CountRows(GroupData) = CountRows(Filter('Updated Budget', TeamLeadName = TeamLeadName1, Status.Value = "Approved")), Collect(RecordsCollection, Filter('Updated Budget', TeamLeadName = TeamLeadName1, Status.Value = "Approved")) ) )

Set the Items property of the Gallery control to following:

RecordsCollection

Best regards,

Kris

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.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,896)