cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rhemo
Level 8

Re: patch for all items in a gallery

it is the collection, StudentList

Meneghino
Level 10

Re: patch for all items in a gallery

OK, that is the issue.  What is the ClearCollect statement to create the collection?

 

PS Basically I am trying to figure out how to recover the table key from the collection, this is because it does not seem present in Gallery1.AllItems

Rhemo
Level 8

Re: patch for all items in a gallery

ClearCollect(StudentList, If(Dropdown4.Selected.Result = "ASD", Filter(Table1, Text(DetentionDate, "[$-en-US]dd/mm/yyyy") = 'Today-Date'.Text && Dropdown4.Selected.Result = LTD_ASD)), Filter(Table1, Year = Dropdown1.Selected.Value && LTD_ASD = Dropdown4.Selected.Result && Text(DetentionDate, "[$-en-US]dd/mm/yyyy") = 'Today-Date'.Text))

Meneghino
Level 10

Re: patch for all items in a gallery

OK, looks ok here.  One final question: can you please take a screenshot of the contents of StudentList from PowerApps Studio so that all columns are visible?
Something like this:

__.JPG

 

Rhemo
Level 8

Re: patch for all items in a gallery

powerapps_err_collection.jpg

 

Hope this helps

Meneghino
Level 10

Re: patch for all items in a gallery

Thank you, it looks like PowerApps is hiding the PowerAppsID to the collection.

The only thing I suggest you try is to do this:

ForAll(Gallery1.AllItems, Patch(Table1, {Actioned...: Gallery1.AllItems.Actioned..., Attend...: Gallery1.AllItems.Attend... etc. etc. }, {Attendance: Toggle1.Value, Notes: TextInput2.Text}))

 

Where you at first include all fields, see what happens.  If that does not work, then you can try to remove the fields one at a time, starting with Image.

 

The reason I am suggesting this is that a patch to an existing record (for example to SQL Server or SharePoint list) just needs the minumum fields of the primary key column (always ID in the case of SharePoint for example).  I am not sure how this can work with Excel if the primary key column is hidden by the system.

 

Obviously Excel was never designed to be a database.  Neither were SharePoint lists, but you might find it smoother to use those as a data source if at all possible.

 

If the above does not work, please let me know and I will experiment with Excel when I get some time.

 

(Sorry but I couldn't read full name of fields in your screenshot)

 

Highlighted
Rhemo
Level 8

Re: patch for all items in a gallery

Many thanks for all your help Meneghino.

I had a feeling excel would not be ideal for this and have been experimenting using the CDM, so I created an Entity to play with. So far im having a few issues using some formulas that worked with the excel file but I feel it will be easier in the long run if i can over come these.

 

If i do not get anywhere with the CDM I will come back to the excel file and try again.

Meneghino
Level 10

Re: patch for all items in a gallery

Yes, I forgot about CDS.  It is a much better alternative than either Excel or SP lists, even though it still does not have the full databsase like suite of features.

Lucindo
Level: Powered On

Re: patch for all items in a gallery

Try this (i'm using a modern sharepoint list): 

 

 

ForAll(Gallery2.AllItems; Patch(<DataSource>; { Existing register }; { Title : Body1_4.Text; Column1: Body1_5.Text}))

 

In my case:

 

ForAll(Gallery2.AllItems; Patch(Table1; { Title : Body1_4.Text;ID:Value(Body1_1.Text)}; { Title : Body1_4.Text; Column: Body1_5.Text}))
Anonymous
Not applicable

Re: patch for all items in a gallery

Hi ,I need bit of help regarding offline mode using sharepoint , I have tried everything but the local cached data is not getting updated in sharepoint when the app is getting reconnected to internet , though it doesn't shows any errors. Offline data not getting updated in sharepoint. Below is my code,

Pointer : When user is offline and trying to make a new entry his record is being saved in Collection "LocalUpdatedRecords" and when he regains the internet connectivity the records should be updated in sharepoint list "Offline test" .I have tried Using Patch ,Update ,Collect etc but nothing seems to update the records in sharepoint, any suggestions will be highly appreciated.

Thanks in advance.

 

If(Connection.Connected && CountRows(LocalUpdatedRecords)>0, ForAll(LocalUpdatedRecords,Patch(OfflineTest,Defaults(OfflineTest),{FirstName :lbl_FirstName,LastName:lbl_LastName,Age:lbl_Age,Mobile:lbl_Mobile})); Clear(LocalUpdatedRecords); SaveData(LocalUpdatedRecords,"LocalUpdatedRecordsToBeAdded"); Refresh(OfflineTest); ClearCollect(OfflineData2,OfflineTest); SaveData(OfflineData2,"LocalCachedData")); Navigate(BrowseScreen1,ScreenTransition.Cover)

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (5,491)