cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

RE:Please help me with the possibility?

HI @RusselThomas@v-xida-msft

 

The issue was not yet resolved with the below solution that you guys provided. But it was helpful

https://powerusers.microsoft.com/t5/General-Discussion/Please-help-me-with-the-possibility/m-p/13295...

I need to submit the request with the submit button click along with the collection.

I have to save the collection information to a separate list with the reference ParentListID.

 

The first list will have the submitted main request and the second list will have the reference ParentListID and the Qty.

 

I am using the following formula on Submit.OnSelect

 

SubmitForm(form1);ForAll(Collection1,Patch('Quantity_List',Defaults('Quantity _List'),{ProductID:EditForm1.LastSubmit.ID,Item ID:ItemID,Quantity:Qty})) 

 

it says patch has some invalid arguments. Please help me with this

11 REPLIES 11
Highlighted
Microsoft
Microsoft

Re: RE:Please help me with the possibility?

Hi Naresh,

 

Your LastSubmit construct looks wrong - you've got

SubmitForm(form1) but EditForm1.LastSubmit

 

If you want to reference the form submitted it should be form1.LastSubmit, so;

 

 

SubmitForm(form1);
ForAll(Collection1,Patch('Quantity_List',Defaults('Quantity _List'),
{ProductID: form1.LastSubmit.ID}))

 

I purposefully left out the other columns in your patch - I'd suggest you first make sure this works, then add the other columns back in.


As I said in your other post though - be aware that by not using the OnSuccess property of the form, you're assuming everything went off successfully.  If it doesn't, you might get submission errors or patch errors or you might capture orphaned data to the source.

 

Hope this helps 🙂


RT

 

Highlighted
Helper IV
Helper IV

Re: RE:Please help me with the possibility?

Hi @RusselThomas

 

In shows Two errors

1.Patch has some invalid arguments

2.ProductID column doesn't exists.

Capture3.PNG

 

Highlighted
Microsoft
Microsoft

Re: RE:Please help me with the possibility?

Hi Naresh,


Either the column you entered doesn't exist, or it exists under a different name. 

Depending on how the list and the column were created, it could be either, so if it's not immediately obvious to you what the problem is, here's a few things to check;

 

First, to test the LastSubmit function - create a new list manually through SharePoint with only two columns - the default Title column you get when creating a new list and add a single-line text column called ProductID. (Do not rename the Title Column, create an additional column called ProductID)

Update your patch to the new table and column label and see if it works.

 

If it does, a few things to check with your original Table;

 

1: Start by replacing ProductID with Title in your patch statement

  • The Title column is usually the first column in a list which cannot be deleted, but can be renamed.  Renaming it however sometimes has odd results - you can see the new name some places, but others still see Title.
  • If you imported your Table into SharePoint then the first column of your Excel sheet would have replaced the Title column - however PowerApps will still read it as "Title".

This is just a guess  🙂

 

If this does not work;

2: Check your original source through powerapps using a simple text label on a screen with a Text property function like First('Quantity Master'). and after the . wait for the field prompts to see if ProductID is listed there. If it isn't, then either it's not there, or it's there under a different name.


Hope this helps

 

RT

 

 

Highlighted
Helper IV
Helper IV

Re: RE:Please help me with the possibility?

Hi @RusselThomas

 

you are Awesome...

I have changed the title field to the ProductID. But still, PowerApps taking it as a title field.

Now it works fine.

 

How to show up all this information in the detailed screen with the child items selected(stored in a collection).

 

and also child items should be deleted Once I delete the parent request.

 

Please help me with this

Highlighted
Microsoft
Microsoft

Re: RE:Please help me with the possibility?

Hi Naresh,


Glad to hear you got it working 🙂

 

Not sure what you mean by

"How to show up all this information in the detailed screen with the child items selected(stored in a collection)."

 

 

But if the detail screen is an edit form for an item from the first source, then you can add any control to the form that references lookups from the second source using the ProductID (or Title as the case may be) reference.

 

So, if someone selects a record from a gallery which takes them to the detail form for the primary source, you can add controls to the details form that reference the secondary source using ProductID=gallery.selected.ID

 

Removing is basically the same in reverse - if someone wants to remove the parent, first go and do a RemoveIf() on the second source using the ProductID reference, then remove the primary source using the ID reference.

 

Hope this makes sense, a bit hard to do without the example in front of me 🙂

If not, take some screenshots that include the screen and formulas you're using and I can try make it more specific

 

Kind regards,

 

RT

Highlighted
Helper IV
Helper IV

Re: RE:Please help me with the possibility?

OK then I will go step by step. Hope you can  help me with this.

Thanks once again for being so supportive.

 

After submission the screen will move to the browsergallery(dashboard screen). From the gallery it will take to the detail screen

here I can see only the parent information how to link with the child data and display here(Child data was stored in the collection)

I want the child data to be display in the gallery.

 

Capture4.PNG

Highlighted
Microsoft
Microsoft

Re: RE:Please help me with the possibility?

Ok, so assuming you have a 1-to-many relationship between a parent record and related children, then you just need to filter the child collection by the currently selected/displayed parent record ID.


So if the top piece is a display form for the parent record, presumably the item it's displaying is whatever was selected on a previous screen gallery;

 

Displayform Item: 

BrowseGallery.Selected

Your bottom piece would then be a filter of your children related to the same parent record, be they in a collection or other source, as follows

 

ChildGallery Items:

Filter(childCollection, ProductID=BrowseGallery.Selected.ID)

Obviously I don't know the precise names of your data sources, controls or columns, just make sure you change the above to reflect them accurately 🙂

 

Hope this helps!

 

RT

Highlighted
Helper IV
Helper IV

Re: RE:Please help me with the possibility?

Hi @RusselThomas

 

ChildGallery Items:

Filter(childCollection, ProductID=BrowseGallery.Selected.ID)

 It means the Childcollection should have the Product ID value init right?

 

But we have patched the collections using the product ID So, We dont have the product ID in the Childcollection.

 

This is the formula I have used to patch the collection data

SubmitForm(EditForm1);
ForAll(cQuantity,Patch('Quantity master',Defaults('Quantity master'),{Title:EditForm1.LastSubmit.ID,Item_x0020_ID:ItemID,Quantity:Qty}));

 

So, how can I bring the product ID to get it filtered here?

Highlighted
Microsoft
Microsoft

Re: RE:Please help me with the possibility?

Sorry, I thought the Title column was your ProductID column?

 

Not sure of the exact column names or structure of your tables, but if you're patching 'Quantity Master' with the LastSubmit.ID of EditForm1, then I'm guessing EditForm1 is updating your primary datasource and 'Quantity Master' is your secondary - therefore if you wanted to filter 'Quantity Master' by all items relating to the primary data source, you would do the following;

 

Filter('Quantity Master', Title=[primary datasource table here].ID)

I posted a response here which talks about primary and foreign keys, there's a picture there that might help.

 

Kind regards,

 

RT

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,006)