cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
CW
Level: Powered On

Collect/Patch

Hello. Had this all written up but MS blew away my note (figures!!!! Everything else opens in a new tab EXCEPT the one you want) so now I have to redo it and its going to be very succinct.

 

  • Using My Expenses app (simple collection version) as model for a Grocery App,
  • Implemeted using ClearCollect and Collect expressions,
  • So far works well and is very snappy,
  • Can't figure out how to get the collection to update my SharePoint lists: Grocery Items and Grocery Item Costs.
  • Below is a screenshot of a screen for updating a Grocery item. Like the model app, there's no gallery, no forms, just fields,

CollectionUpdate.png

 

Heres the code that runs "Yes" button to update the item.

 

UpdateIf(collGroceryItems, ID = SelectedItem.ID,{Title: DataCardTitle.Text, NOTE: DataCardNote.Text, STATUS: DataCardStatus.Selected, ITEM_x0020_CATEGORY: DataCardCategory.Selected, STORE_: DataCardStore.Selected, Organic: DataCardOrganic.Value});
Set(SelectedItem, LookUp(collGroceryItems, ID = SelectedItem.ID));
Back()

It works well but doesnt update the SP list which would also be an issue with create new and create new line item and edit line item. If I can get this working I can hopefully get the expression to work elsewhere.

 

I know patchcan be simple but I've tried the patch syntax with my code in different arrays but one that didnt return the red squiggly line error also didnt update my SP list.

 

I do understand I could've used a standard technique of a gallery or edit form, but at the time all I had that worked was the Expenses app that works plus, it seems snappier than constantly connecting to SharePoint form a store.

 

Thanks in advance for any help anyone has to offer.

 

CW

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Collect/Patch

The documentation tells you to create the lists, so you should know where they are installed.  Importing the app doesn't install the lists.  importing the app is the easiest way to connect to the lists that you created.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

8 REPLIES 8
Dual Super User
Dual Super User

Re: Collect/Patch

Did you go thorough the Installation instructions available on the web?  By default a lot of these sample apps use hardcoded local collections for data.  They then provide instructions for how to convert it to a sharePoint list.  Take a look at these instructions.

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/expense-report-install



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
CW
Level: Powered On

Re: Collect/Patch

Hi Pstork. Actually, I did based on a previous note you sent me precisely for that app. but, as is to be expected, the import function was down so I went ahead with the hard way of doing it.

 

I did successfully import today and tried it out but, again, as is to be expected, it cant connect to my tenant because its going through some third party service that I cant be bothered, again doing more research on. Can't it be simple enough to just connect to my tenant without having to go through some other stupid service??????

 

Just connect with the given credentials, period!!! MS always has to needlessly add unecessary, complicated and convoluted procedures. So, I cant even test the sample app. Man Frustrated

 

Also, there's no indication anywhere that I can find explaing where the lists were installed within my tenant. Imagine that? I assumed root but nope. So as per usual, a day or two will be required just to locate the lists.

 

 

it would be easier without this stupidity:

ExpenseConnectionIssue.png

I wasn't asked to go through this service, I don't want to go through this service, I JUST WANT THE APP TO INSTALL WHERE I TELL IT AND WORK!!!!!

CW
Level: Powered On

Re: Collect/Patch

Ok finally got the Expense app working. However, I'm still not sure if I should use this technique or stick with my Collect technique.

 

If I go with the Collect technique, I still cant get the patch expression working on the above code. Also, the lineitem screen uses a FLUID GRID. ?????????? UH ya so where's the intel on that?????? I see people complaining about it but no where to be seen on how to install.

 

What? Another Microsoft research project??!!

 

Thanks again.

 

CW

CW
Level: Powered On

Re: Collect/Patch

EDIT:

 

I updated the code to include a patch:

Patch(collGroceryItems, UpdateIf(collGroceryItems, ID = SelectedItem.ID,{Title: DataCardTitle.Text, NOTE: DataCardNote.Text, STATUS: DataCardStatus.Selected, ITEM_x0020_CATEGORY: DataCardCategory.Selected, STORE_: DataCardStore.Selected, Organic: DataCardOrganic.Value}),collGroceryItems);
Set(SelectedItem, LookUp(collGroceryItems, ID = SelectedItem.ID));
Back()

No errors, but doesn't update the SP list. 😞

Dual Super User
Dual Super User

Re: Collect/Patch

The documentation tells you to create the lists, so you should know where they are installed.  Importing the app doesn't install the lists.  importing the app is the easiest way to connect to the lists that you created.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

CW
Level: Powered On

Re: Collect/Patch

Aye, you're right. I posted a while ago about getting it working, but, I would like to have the patch technique work then test both out and about to se which works best.

Thanks again!!

CW
Dual Super User
Dual Super User

Re: Collect/Patch

To use patch to update existing records the second parameter needs to identify one and only one record to bue updated.  YOu are using an UpdateIf there.  I don't think that logic will work.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
CW
Level: Powered On

Re: Collect/Patch

I thought the patch statement would nest the updateif statement so updating the collection, putting it into memory then the patch no?

Either way, it needs to patch the SP list. So you advocate replacing update if with patch?

Thanks

CW

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,744)