cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Issue with collections and updating a Sharepoint List

Hi, I'm hoping for some help trouble shooting the relationship between Sharepoint and my collection. This is my first attempt at app building with Power Apps.

 

Background

I'm trying to do a simple app that serves as a meeting agenda for a group of users (see attachment)

It is designed so that each user can add agenda item to the list and can update the list.

The user enters an agenda item into the text input, then clicks the [Add to agenda] button

 

 

Collect(AgendaItems, {Title:AddItem.Text, AgendaUser:User().FullName}); Reset(AddItem)

 

 

This creates a collection called AgendaItems that contains the Title (the description of the agenda item), and the user's full name.

This agenda item is then added to a gallery that displays the agenda:

 

The gallery is populated from the collection.

If the user wishes to save their addition, they click the [Save agenda] button:

 

 

RemoveIf(AgendaList, true);Collect(AgendaList, AgendaItems)

 

 

Which clears the existing sharepoint list and updates it with the current version of the collection.

 

For OnVisible, I have:

 

 

ClearCollect(AgendaItems, AgendaList)

 

 

Which clears the collection and populates it with the AgendaList before the user begins.

 

Problem

Now, my latest problem is that the [Save agenda] returns that my AgendaList Sharepoint list can't be found. But this is only an issue with the RemoveIf function, it saves the changes properly. My bigger issue is that agenda items don't properly load from the collection to Sharepoint and vice versa.

Any insight into what could be happening? I'm not absolutely confident in my use of Collect, ClearCollect, and RemoveIf despite having read up on their usages...

I'm open to suggestions for simplifying the whole system (e.g. if there is a way to avoid using collections altogether)

 

Thanks for reading.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Issue with collections and updating a Sharepoint List

@NZrinyi 

Yes, not entirely sure why you would use a collection at all.  You might consider just using the DataSource as your Items property for the Gallery and then change your Add to Agenda button to the following:

Patch(AgendaList, Defaults(AgendaList),
    {Title:AddItem.Text, 
     AgendaUser:User().FullName
    }
); 
Reset(AddItem)

 

If you have a delete button on the Gallery, set it to RemoveIf(AgendaList, ID=ThisItem.ID)

 

Finally, what kind of column is AgendaUser?  Is it a text column or a person column?  If it is a person column, that will cause you some issues and probably why you had troubles that you were seeing.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

1 REPLY 1
Highlighted
Super User III
Super User III

Re: Issue with collections and updating a Sharepoint List

@NZrinyi 

Yes, not entirely sure why you would use a collection at all.  You might consider just using the DataSource as your Items property for the Gallery and then change your Add to Agenda button to the following:

Patch(AgendaList, Defaults(AgendaList),
    {Title:AddItem.Text, 
     AgendaUser:User().FullName
    }
); 
Reset(AddItem)

 

If you have a delete button on the Gallery, set it to RemoveIf(AgendaList, ID=ThisItem.ID)

 

Finally, what kind of column is AgendaUser?  Is it a text column or a person column?  If it is a person column, that will cause you some issues and probably why you had troubles that you were seeing.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

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 designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,796)