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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / On submit last item is...
Power Apps
Unanswered

On submit last item is empty

(0) ShareShare
ReportReport
Posted on by 35

Looking for a little help with this one.

 

 Onselect of a submit button everything gets submitted all but  last item from the collection. Attached is the formula I'm using for the submit button. 

 

Does anyone have a fix for this? 

 

pa.jpg
splist.jpg
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,756 Most Valuable Professional on at

    Hello @mperez84 ,

    How do you form the variable downingid and what is the field type in the data source?

  • mperez84 Profile Picture
    35 on at
    Hi @WarrenBelz

    The “Downingid” is being collected from an SharePoint list as a single column that column is a single line text field. The collection is set to collect from the gallery base on the users selections.
  • GarethPrisk Profile Picture
    2,828 on at

    A few things to note from your screenshot.

    • The ForAll function appears syntactically correct, and should Patch each row from the collection, back to SharePoint
      • I assume you intend for each 'Asset Request' to have the fixed Trade Show Title value at run-time
      • See below regarding disambiguating the destination column downingid from the collection column of the same name
    • Not sure why you have the SubmitForm, NewForm, and ResetForm functions after the ForAll function
      • It doesn't matter, and shouldn't impact what you're trying to do with the Patch(es)
      • Just wanted to point out that this is happening AFTER the ForAll function, in case you were intending/trying to do it for each loop of the ForAll

     

    I recommend that you disambiguate the columns in your collections, to ease writing functions against them. For example, when you collect into Collection1, use something like 'appDowningId' instead. Then, when you're writing your Patch function in the ForAll, it will be much clearer when you're referencing that column or the destination's column.

    Speaking of which, is the column in the SharePoint list actually downingid - why aren't you referencing the display name like the 'Trade Show Title' column?

     

  • WarrenBelz Profile Picture
    155,756 Most Valuable Professional on at

    Thanks @mperez84 ,

    So downingid is a text field in Collection1 and you are patching this together with a static value from your screen as new records to a data source with a ForAll looping through the collection and it does not Patch a valid value.

    The first thing I would suggest you try is as suggested by @GarethPrisk and rename the field in the collection to something else.

    We can continue from there between us if that does not solve the issue.

     

     

  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @mperez84 ,

    Do you mean that the downingid field hasn't been updated successfully?

    If so, I notice that you have the same field name in the collection and the list, which may lead some problems.

    I suggest you use [@] to avoid ambiguity.

    Try this formula:

    ForAll(Collection1,Patch('Asset Request',Defaults('Asset Request'),{'Trade Show Title':DataCardValue1.Text,downingid:Collection1[@downingid]}))

     

     

    Best regards, 

  • mperez84 Profile Picture
    35 on at

    @WarrenBelz

     

    I've changed the reference name from downingid to appdowningid, that didn't fix it.  I found when I removed from the onselect button formula the clear(collection1) the issue goes away.  But then obvious happens, when I select new form the previous selected data is there. 

     

    Is there another way to clear the collection after submit? 

  • GarethPrisk Profile Picture
    2,828 on at

    When you say 'submit', are you referring to?

    1. Patching of 'Asset Request' record(s) from Collection1
    2. The SubmitForm action for SharePointForm1

    The ForAll function will loop through and create/update a record per row in Collection1 via the Patch function.

    The SubmitForm function will causes that form to submit to the database. You can hook into it's OnSuccess action to perform another action, such as clearing Collection1.

     

    What is SharePointForm1 connected to? What are you submitting via that?

    Can you review/confirm Collection1 prior to the ForAll patch, to ensure all columns have data?

  • mperez84 Profile Picture
    35 on at

    Hey @GarethPrisk 

     

    Yes sorry ''submit'' is just the reference name to my button. 

     

    The Sharepointform1 is connected a sharepoint list named  "Asset Request". This is where the collection and trade show title text field is being written back too. 

     

    I've confirmed all the data during collection is there prior to the patch. 

     

    removing the clear(collection1) from the ForAll/patch function causes all the columns to write appropriately. 

     

    I'm not sure where else to try the clear collection function at. Ideally I would like this to be a single onselect button function. 

     

     

     

     

  • GarethPrisk Profile Picture
    2,828 on at

    Okay, to clarify something real quickly:

    • The Form SharePointForm1 is connected to 'Asset Request'
      • This means, that when you invoke SubmitForm() against SharePointForm1, it will try to create/update a record in the 'Asset Request' list
    • The Patch function against Collection1
      • Is looping through the records in Collection1, and executing Function(s) against each row
      • The Patch function will create/update (create in your example, with Defaults() used) an 'Asset Request' record for each loop (record within Collection1)

    The way your formula was written in the original screenshot indicates:

    • An 'Asset Request' record would be created for each row in Collection1
    • An 'Asset Request' record would be updated/created when you SubmitForm()

     

    How are you collecting into Collection1?

    Should you be creating a list of records, and then creating/updating another/an existing record as well?

  • mperez84 Profile Picture
    35 on at

    @GarethPrisk 

     

     

     

    Collection1 data is being driven from a gallery.selected function to only select the downingid. from a separate datasource(splist).

     

    No my intentions is to use this form purely for gathering the request information from the user then sending an email notification to another user to check out the selected items. 

     

     

     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard