web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / RE:Please help me with...
Power Apps
Unanswered

RE:Please help me with the possibility?

(0) ShareShare
ReportReport
Posted on by 143

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/132955#M46169

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

Categories:
I have the same question (0)
  • RusselThomas Profile Picture
    4,014 on at

    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

     

  • Naresh Profile Picture
    143 on at

    Hi @RusselThomas

     

    In shows Two errors

    1.Patch has some invalid arguments

    2.ProductID column doesn't exists.

    Capture3.PNG

     

  • RusselThomas Profile Picture
    4,014 on at

    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

     

     

  • Naresh Profile Picture
    143 on at

    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

  • RusselThomas Profile Picture
    4,014 on at

    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

  • Naresh Profile Picture
    143 on at

    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

  • RusselThomas Profile Picture
    4,014 on at

    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

  • Naresh Profile Picture
    143 on at

    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?

  • RusselThomas Profile Picture
    4,014 on at

    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

  • Naresh Profile Picture
    143 on at

    Hi @RusselThomas

     

    The formula you have given some errors.

     

    Somehow the Below formula desoved the issue

    Filter('Quantity master',Title=BrowseGallery1.Selected.ID)

    Can you please help me with the delete operation.

     

    If the parent Item is deleted the child Item also be deleted. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard