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 / PowerApps Add Row Func...
Power Apps
Unanswered

PowerApps Add Row Function - Data being cleared

(0) ShareShare
ReportReport
Posted on by 75

Hi all, I am in a bit of a rut with this one.

I have created an "Add Row' button for my editable gallery in powerapps using the below formula (from Reza) Patch('Purchase Requisition Forms',Defaults('Purchase Requisition Forms'),{Quantity:""}) however, I will add in the required information into the new row and then when I click the "Add Row" button for a new row the text from the above row (that is already filled in) disappears. I have no idea what I am doing wrong. 

Has anyone run into this problem before?

I am using a collection to a dataverse table

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @CAJ1 ,

     

    Looking at the formula, it is supposed to create a new, empty, row. In case you want it to be populated with some value, you need to include a reference in your formula that references the value to be populated.

     

    Can you share which control (name, type and context) should provide the initial value?

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @CAJ1 ,

    That is because the gallery resets and you need to save your Quantity field to your 'Purchase Requisition Forms' (I assume collection) so OnChange of the Text control you would need to

    Patch(
     'Purchase Requisition Forms',
     ThisItem,
     {Quantity: Value(Self.Text)
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • CAJ1 Profile Picture
    75 on at

    So what I am doing is creating a line, typing in the stuff I need and then adding a new row straight after... Like a stationary order (purchase requisition form) but when i click add row the information I input above that new line goes away

  • CAJ1 Profile Picture
    75 on at

    I am also using this formula for each input in the gallery 

     

    If(
    ThisItem.'Purchase Requisition Form' in colRowUpdates.cr67d_purchaserequisitionformid,
    Update(
    colRowUpdates,
    LookUp(
    colRowUpdates,
    cr67d_purchaserequisitionformid = ThisItem.'Purchase Requisition Form'
    ),
    {
    cr67d_purchaserequisitionformid: ThisItem.'Purchase Requisition Form',
    cr67d_name: Qty.Text,
    cr67d_procurementtype: ProcType.Selected.Value,
    cr67d_costtype: CstType.Selected.Value,
    cr67d_itemdescription: ItemDesc.Text
    }
    ),
    Collect(
    colRowUpdates,
    {
    cr67d_purchaserequisitionformid: ThisItem.'Purchase Requisition Form',
    cr67d_name: Qty.Text,
    cr67d_procurementtype: ProcType.Selected.Value,
    cr67d_costtype: CstType.Selected.Value,
    cr67d_itemdescription: ItemDesc.Text
    }
    )
    )

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    @CAJ1 ,

    As I posted, you need to save the line changes to the data source before you create a new line.

  • CAJ1 Profile Picture
    75 on at

    Ah okay, so I need to save each time a line is created for the data to stay in the rows?

  • CAJ1 Profile Picture
    75 on at

    I literally copied this word for word https://www.youtube.com/watch?v=8I0Pt_8I6k8 

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    @CAJ1 ,

    Yes - you need to do that - sorry I do not have the time to watch and analyse a video.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @CAJ1 ,

     

    From around the 9:36 mark in the video, it is explained how the data gets saved: One option is by adding a Patch function to the OnChange property of the input controls in the grid, as mentioned by @WarrenBelz .

  • CAJ1 Profile Picture
    75 on at

    So, do I need to add the patch function to this formula?

    If(
    ThisItem.'Purchase Requisition' in colRowUpdates.cr67d_purchaserequisitionid,
    Update(
    colRowUpdates,
    LookUp(
    colRowUpdates,
    cr67d_purchaserequisitionid = ThisItem.'Purchase Requisition'
    ),
    {
    cr67d_purchaserequisitionid: ThisItem.'Purchase Requisition',
    cr67d_name: Qty.Text,
    cr67d_procurementtype: Proc.Selected.Value,
    cr67d_costtype: Cst.Selected.Value,
    cr67d_itemdescription: Desc.Text
    }
    ),
    Collect(
    colRowUpdates,
    {
    cr67d_purchaserequisitionid: ThisItem.'Purchase Requisition',
    cr67d_name: Qty.Text,
    cr67d_procurementtype: Proc.Selected.Value,
    cr67d_costtype: Cst.Selected.Value,
    cr67d_itemdescription: Desc.Text
    }
    )
    )

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard