cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
suriyamv07
Helper I
Helper I

Merge Form and Gallery & Collect Gallery AllItems

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? 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ovebaa
New Member

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)

View solution in original post

5 REPLIES 5
ovebaa
New Member

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)

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

 

Thanks much 🙂

suriyamv07
Helper I
Helper I

@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?

 

 

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

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.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,087)