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 / Merge Form and Gallery...
Power Apps
Answered

Merge Form and Gallery & Collect Gallery AllItems

(0) ShareShare
ReportReport
Posted on by 108

Hi All,

I have form which displays name . Gallery to display module records which will be added based on user request(Add row has been implemented using collection concept). In my case, name will be static for all the row of records and modules count will get increased based on user request.

suriyamv07_0-1659432345903.png

Here is should get the response like, 

 

Col_Name - Title 	 Module Activity 		No of Lines
Row 1 - Test Title Order Rec. Order Rec. 		4
Row 2 - Test Title Part Ordering Order Batch wise 	2

 

 

But below is the response , i am receiving,

 

suriyamv07_1-1659432571884.png

 

Here is code written on Submit button,

 

ForAll(
 Gallery3.AllItems As A, 
 Patch(
 'SP_List',
 Defaults('SP_List'),
 {
 Title: Title_Value.Text,
 Module: Module_Dropdown.Selected.Result,
 Activity: Activity_Dropdown.Selected.Result,
 'No of Lines': Value(Lines.Text)
 }
 )
);
ResetForm('User Form');

 

Below is code used to add rows,

 

Collect(
 CollItems,
 {
 CNumber:Text(Last(CollItems).CNumber +1)
 }
)

 

 

Mapped this "CollItems" in Item property of gallery.

 

Could anyone please help on this? 

 

 

Categories:
  • Verified answer
    ovebaa Profile Picture
    12 on at

    These outlined words:

     

    Title: Title_Value.Text,
    Module: Module_Dropdown.Selected.Result,
    Activity: Activity_Dropdown.Selected.Result,
    'No of Lines': Value(Lines.Text)

     

    Refers directly to the defining control in the gallery, aka the first record. They are not in context of which record the ForAll is at, therefore you need to add the selector like this:

     

    Title: A.Title_Value.Text,
    Module: A.Module_Dropdown.Selected.Result,
    Activity: A.Activity_Dropdown.Selected.Result,
    'No of Lines': Value(A.Lines.Text)

  • suriyamv07 Profile Picture
    108 on at

    Thanks @ovebaa . It worked. I have removed the Selector for Title alone , since it is present outside of Gallery.

     

    Thanks much 🙂

  • suriyamv07 Profile Picture
    108 on at

    @ovebaa I have one more query. In that form, i have attachment field too. I tried to store that attachment also and added the below line  in patch formula, 

    SP column name - Attachments_column_SP

    Form field name - :Attachment_content_value

    Datatype: Attachments

    Attachments_column_SP:Attachment_content_value.Attachments

     

    But it i throwing error,

    suriyamv07_1-1659441288032.png

     

    Could you please confirm how to mention the attachments in patch function?

     

     

  • ovebaa Profile Picture
    12 on at

    It seems that Patch does not support attachments:

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Saving-attachments-using-Patch/td-p/277984

     

    As the thread mentions, you can try submitting the form instead

  • suriyamv07 Profile Picture
    108 on at

    Thanks for the confirmation Ovebaa. I have tried using "Form.Updates" in patch and that allowed me to store the attachments as well in SP.

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard