
Announcements
Hello,
I'm building an app wherein there is flow of stakeholder actions and using gallery to navigate to each screen for that.
In Context: Stakeholder1 screen. Buttons on S1 screen: Add for Location, Save.
When I navigate to the screen for S1, it has a gallery ( items created using Screen OnVisible = ClearCollect(colItemtoUpdate, Filter(Datasource, request id = varRequestId)
I should be able to add new rows(populate new rows in the collection by clicking Add for Location)/edit current rows and patch it back to the datasource.
The row added in collection has 4 columns already populated from that button OnClick and 1 item is to be updated manually.
When I populate the last column items(it is updated in the collection using onchange/updateif functions)
Till here, all details are getting updated to the collection realtime as checked. The problem is when I patch this collection by clicking Save button, it patches to new rows everytime.
I want to patch and update records according to the datasource columns and rows.
For eg. if there are 4 locations, I select 1 location and onclick Add for Location it gives me x rows in collection.
I add the final column input with manual inputs and click on Save and it should patch data to the excel in a new row only if the rows don't exist. If the row exists(saved earlier) then it should update the same rows.
Whenever I am patching back to datasource it is not updating the existing rows, tried LookUp(Datasource, UID=ThisRecord.UID) but this fetches no input as ThisRecord is blank.
All I want is in this COLLECTION, whenever I make edits in the gallery, it should update the existing rows/add new rows if not found on clicking Save
For reference, the Save button OnClick is having function:
Patch(Datasource, ShowColumns(collectionName, 'Columname1', 'Columname2', 'Columname3', 'Columname4'))
This works when I am adding new rows but when I navigate back to previous screen and come back it does show already existing items in gallery but this time when I update previously existing items/make changes. It adds to a new row altogether.
If 2 rows are there and I save, new rows are created. When I revisit the same request, and add 4 more rows based on location, it populates in the collection and updates all data in the collection. At the time of patching to datasource, it adds 6 rows now instead of 4 and does not update existing rows if i made changes to previously added rows.