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

Connect Nested Galleries

I have a nested gallery: glyUnitCount

Items: GroupBy(AddColumns(Filter(AttendanceData,Program=varProgram,YRweekNumber=lblYrWeekNum_1.Text,P_or_A="P"),"UnitNum",LookUp(colAlist,Name = AttendeeName,NumberOFUnits)),"AttendeeName","UnitNum","UnitbyAttendee")

 

Parent gallery: glyDaily 

Items: Filter(colAlist,End_Date>=dtAttendanceDate.SelectedDate And Start_Date<=dtAttendanceDate Or IsBlank(End_Date),Program=varProgram)

 

My Data is a Sharepoint List.... AttendanceData, and a Collection.... colAlist.

I can not seem to get the syntax correct to tie them together by AttendeeName.  This does not have to be nested galleries but I can't figure out how to combine the two.  Essentially I need the filter from the Parent gallery to filter the nested gallery.

Any suggestion is appreciated!

 

1 ACCEPTED SOLUTION

Accepted Solutions

@Drrickryp and @Eelman 

I was able to get it to connect with a Filter...

GroupBy(Filter(tblUnitCount,AttendeeName=ThisItem.AttendeeName),"AttendeeName","UnitbyAttendee")

Thank you both for your suggestions!

View solution in original post

8 REPLIES 8
Eelman
Super User
Super User

@elkay73 

I'm just trying to understand what you are trying to achieve here. Is the aim to get the Parent gallery to display the related data from AttendanceData? Could you provide an example of your end goal.

 

In the interim and as a suggestion, you could try using ThisItem in your nested gallery, like this:

GroupBy(
    AddColumns(Filter(
                AttendanceData,
                   Program=ThisItem.varProgram,
                   YRweekNumber=lblYrWeekNum_1.Text,P_or_A="P"),
         "UnitNum",ThisItem.NumberOFUnits),
    "AttendeeName",
    "UnitNum",
    "UnitbyAttendee"
)

Essentially, you can reference the Parent gallery inside the nested gallery by using ThisItem, hence all of the Parent gallery data is available to use via this method.

 

 

@Eelman 

End result is to know if there are units left to use.

Each week an AttendeeName has a NumberOFUnits.  These are stored in the collection colAlist.  I then need to count the UnitbyAttendee  (this is a count of records from AttendanceData sharepoint list that match the Program and AttendeeName) used for a given weekAnd subtract that from the NumberOFUnits.  So basically colAlist.NumberOFUnits - UnitbyAttendee = Units remaining.  While filtering by the chosen dropdown Program.  

 

I tried your code and I get a warning that 'This formula uses scope, which is not presently supported for evaluation.

This warning for both "ThisItem." codes.

I was able to change one from Program = ThisItem.varProgram, to Program = varProgram.  And that helped.  

I want to see just the matching Attendee's info in the sub gallery so would a Lookup be appropriate/helpful?

Ugh, I just noticed by NumberOFUnits is not being added as a the correct values for AttendeeData.  It is populating a column but the value is only the first available.  I don't understand why it's so difficult to combine 2 sources that have a common field.

Update...I've tried to simplify things... I now have these galleries...

glyUnitCount

GroupBy(Filter(AttendanceData,Program=varProgram,YRweekNumber=lblYrWeekNum_1.Text,P_or_A="P"),"AttendeeName","UnitbyAttendee")

 

 

Parent gallery: glyDaily 

Sort(Filter(colAlist,End_Date>=dtAttendanceDate.SelectedDate And Start_Date<=dtAttendanceDate Or IsBlank(End_Date),Program=varProgram),AttendeeName)

I have included the NumberOFUnits field in a label - lblNumUnit.

 

Now I need to tie the two galleries together so that I can make the calculation "NumberOFUnits - UnitbyAttendee''

 

@elkay73 

Do you have some sample data you can show me? I'm still not picking up what you are putting down. You can 'join' two tables but it can either easy or difficult depending on your setup and needs.

Drrickryp
Super User II
Super User II

Hi @elkay73 

The easiest way to do this is to use GroupBy() on the Child table and group on the foreign key. 

 

GroupBy(ChildTable, "ForeignKey","RestOfData")

 

You can then fill out the rest of the items in the outer Gallery by using lookups to the  Parent table, for example,

Lookup(ParentTable, ID=Foreign key, Field1).  The subgallery Items property would be ThisItem.RestOfData.

@Eelman  

I've tried cutting everything down and just don't know where to put the Lookup clause.

Parent - glyDaily

Items:  tblDaily

 

Child - glyUnitCount

Items: GroupBy(tblUnitCount,"AttendeeName","UnitbyAttendee")

Attached is some sample data

 

 

@Drrickryp and @Eelman 

I was able to get it to connect with a Filter...

GroupBy(Filter(tblUnitCount,AttendeeName=ThisItem.AttendeeName),"AttendeeName","UnitbyAttendee")

Thank you both for your suggestions!

View solution in original post

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 (28,912)