cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JMAFO
Helper V
Helper V

Add empty rows to gallery with SharePoint list as datasource

Hello everyone,

 

I have a gallery that is set to a SharePoint list. The idea is that the user can edit existing items in the SharePoint list, but also create additional items (only 5 total items at one time in gallery). 

 

For example, the SharePoint list contains entries for 3 items, I need the gallery to display those 3 items and then an additional 2 "blank" items that will allow me to enter data into them and then save back to SharePoint. 

 

Is it possible to add empty rows to a gallery that uses a SharePoint list as it's data source? Should I first import it into a collection and then use the collection as the gallery data source?

1 ACCEPTED SOLUTION

Accepted Solutions

@JMAFO 

Yes, makes perfect sense and again pretty easy to implement for your collection.

 

Here is kind of pseudo formula for it (don't take verbatim):

ClearCollect(myCol,
    Filter(yourSource, condition)
);

ForAll(Sequence(5 - CountRows(myCol)),
   Collect(myCol, ABlankRecord)
)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

8 REPLIES 8
RandyHayes
Super User III
Super User III

@JMAFO 

You will not be able to add additional rows in the way you mention by using a datasource straight out.

You will need to bring the items into a collection and then add the empty rows.

Unfortunately!

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hello again Randy, 

 

Thank you for the quick response! I'm debating on utilizing five separate forms, or using a collection. The issue is that the number of empty rows in the collection has to be dynamic depending on drop down values. 

@JMAFO 

A collection would be pretty easy to implement in this case.  Just load in the rows that have values and then add the remaining rows based on your dropdown.  That would be far easier to maintain than 5 forms!

Let me know if you have questions on how to do that.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

So here's where it gets tricky. 

 

There's a limit on having 2 to 5 'Active' items at one time. The app consists of a screen that has items from 6 months ago that each have to be determined either 'Active' or 'Completed' in the first section of the screen via their respective drop down, and then new items are added at the second section of the screen.

 

The number of 'new' items on the second section of the screen is determined by the status of each drop down of the items on the first section of the screen, for instance, if there's 3 items and I chose 'Completed' for all 3, then five empty items should populate for the second half of the screen.

 

Because the user can essentially change the values of the drop downs at any time, it's important that the number of 'new' items on the second half of the screen should be completely dynamic. 

 

Let me know if that makes sense!

@JMAFO 

Yes, makes perfect sense and again pretty easy to implement for your collection.

 

Here is kind of pseudo formula for it (don't take verbatim):

ClearCollect(myCol,
    Filter(yourSource, condition)
);

ForAll(Sequence(5 - CountRows(myCol)),
   Collect(myCol, ABlankRecord)
)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

I'll try this. Seems more logical than the five forms approach!

 

Really appreciate your help, again! 

@RandyHayes 

 

Sorry to keep bugging you, but how would I utilize this to both update the records displayed in the gallery if it exists, or create a new one if it doesn't exist? 

@JMAFO 

No worries.

I would ForAll through the collection and look at the ID of the record.  If it is >0, then it is an existing record - UpdateIf it.

If it is not, then Patch new it.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,503)