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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / One Gallery per List o...
Power Apps
Answered

One Gallery per List or One gallery for all lists

(0) ShareShare
ReportReport
Posted on by 175

Hi All.

 

I have a screen that is used to view/update 7 Sharepoint lists. All the lists have the same format of columns.

 

Is it best practive to have a gallery for each list (i.e. 7 galleries that are hidden/shown depending on variable) or should I have one gallery for all 7 lists (i.e. datasource is based on if statement/variable).

 

Barry

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at

    @barrymac20
    Having only 1 gallery for 7 lists with the same structure is my own 'best practice' in this scenario because its less work to maintain.  But the 7 lists it displays data from must always have all the same formats and columns.  You'll have to make sure all lists maintain parity.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

  • barrymac20 Profile Picture
    175 on at

    Cheers.

     

    I starteed out with 7 galleries but its a pain to make changes. I'm currently updating so I have only one gallery and I have noticed that it is a tad bit slower cycling between the datasources but I do think it will perform better in the long run.

     

    This is my if statement for the gallery Items. The variable is a true or false value depending on the button selected. Any suggestions to improve?

     

    If(varACB, Sort(collMCCBProductlist,ID),

    If(varACB_Ass, Sort(collACBAccessoriesProductlist,ID),

    If(varMCCB, Sort(collMCCBProductlist,ID),
    If(varMCCB_Ass, Sort(collMCCBAccessoriesProductlist,ID),

    If(varILine, Sort(collILineProductlist,ID),

    If(varIC, Sort(collInstrumentationCableProductlist,ID),
    If(varSundries, Sort(collSundriesProductlist,ID)

    )))))))

     

    This is my patch code that updates a quantity field in the relevant list. Any suggestions to improve?

     

    Patch(

        If(varACB, 'ACB Product List',

        If(varACB_Ass, 'ACB Accessories Product List',

        If(varMCCB, 'MCCB Product List',

        If(varMCCB_ass, 'MCCB Accessories Product List',
        If(varILine, 'I-Line Product List',
        If(varIC, 'Instrumentation & Cable List',

        If(varSundries, 'Sundries Product List'
        ))))))),

            First(Filter(

            If(varACB, 'ACB Product List',

            If(varACB_Ass, 'ACB Accessories Product List',

            If(varMCCB, 'MCCB Product List',

            If(varMCCB_ass, 'MCCB Accessories Product List',
            If(varILine, 'I-Line Product List',
            If(varIC, 'Instrumentation & Cable List',

            If(varSundries, 'Sundries Product List'
            ))))))),


                ProductID=ThisItem.ProductID And PartID = ThisItem.PartID)), {Quantity: Value(TextInput4_12.Text)});

     

    ClearCollect(

        If(varACB, Sort(collMCCBProductlist,ID),

        If(varACB_Ass, Sort(collACBAccessoriesProductlist,ID),

        If(varMCCB, Sort(collMCCBProductlist,ID),
        If(varMCCB_Ass, Sort(collMCCBAccessoriesProductlist,ID),

        If(varILine, Sort(collILineProductlist,ID),

        If(varIC, Sort(collInstrumentationCableProductlist,ID),
        If(varSundries, Sort(collSundriesProductlist,ID)

        ))))))),

            Filter(

            If(varACB, 'ACB Product List',

            If(varACB_Ass, 'ACB Accessories Product List',

            If(varMCCB, 'MCCB Product List',

            If(varMCCB_ass, 'MCCB Accessories Product List',
            If(varILine, 'I-Line Product List',
            If(varIC, 'Instrumentation & Cable List',

            If(varSundries, 'Sundries Product List'
            ))))))), 

                ProductID = Value(varThisProductInfo.ProductID)));

  • Verified answer
    mdevaney Profile Picture
    29,989 Moderator on at

    @barrymac20 

    I would organize the Items property like this and rely-on a single variable rather than 7 variables.  Not sure if its faster, but its worth a shot!

    Switch(
     varWhichDatasource,
     "ACB", Sort(collMCCBProductlist,ID),
     "ACB_Ass", Sort(collACBAccessoriesProductlist,ID),
     "MCCB", Sort(collMCCBProductlist,ID),
     "MCCB_Ass", Sort(collMCCBAccessoriesProductlist,ID),
     "ILine", Sort(collILineProductlist,ID),
     "IC", Sort(collInstrumentationCableProductlist,ID),
     "Sundries", Sort(collSundriesProductlist,ID)
    )


    Sorry, I don't have a suggestion for your PATCH function at this time.  You may wish to post it as a new question so it gets the attention it deserves.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

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

Forum hierarchy changes are complete!

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 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard