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 / Collect and Patch func...
Power Apps
Answered

Collect and Patch function Help - Please

(0) ShareShare
ReportReport
Posted on by 216

@RezaDorrani 

Hi everyone!  Several of the community members have reached out and have been a huge assistance.  I have been watching @RezaDorrani videos are awesome as well as reading numerous posts, but I am still stuck.  The good news is I was able to create a collection but other than that I haven’t made much progress.

 

Here’s what I am trying to do.  I have a SharePoint List titled “New Unanet Form List Test” and it has the following columns:  Title (shown on form as Price Model), Call Order(single line of text, but conditional drop down on form), Task (single line of text), Position (single line of text), PoP (there is only one column on the SP list as PoP and it’s a single line of text), and Call Order Rate (single line of text).

 

What I am trying to do is when someone populates the Price Model, Call Order, Task, Position, PoP fields, and Call Order Rate the information appears on a separate line in the SP list titled “New Unanet Form List Test”.  The problem I am having is with the PoP fields.  I need all the information to populate on separate lines. 

 

For example if I enter the below information into the form:

 

Price Model:  FFP

Call Order:  Project 1

Task:  Tester

Position: Master Tester

PoP:  1/1/21 – 2/1/23

          2/2/23 – 3/1/24

          3/2/24 – 3/5/26

Rate:  70.00

It will appear like the below in the SharePoint List:

Title

Call Order

Task

Position

PoP

Rate

FFP

Project 1

Tester

Master Tester

1/1/21 – 2/1/23

70.00

FFP

Project 1

Tester

Master Tester

2/2/23 – 3/1/24

70.00

FFP

Project 1

Tester

Master Tester

3/2/24 – 3/5/26

70.00

 

I have also detailed how my form is laid out below

Brian_S_0-1683899333761.png

 

Finally I have put below what I have done so far, but there are so many eorrs I have no idea where to begin

Clear(PoP);

Collect(PoP,txtPop.Text);

Collect(PoP,txtPop_1.Text);

Collect(PoP,txtPop_2.Text);

Collect(PoP,txtRate.Text);

Patch(

    ForAll{'New Unanet Form List Test',Defaults(PoP),{Title:drpPriceModel.Selected,Call Order:drpCallOrder.Selected,Task:txtTask.text,Position:txtPosition.text,Call Order Rate;txtRate.text}));

 

I appreciate all of the assistance everyone has given, but this is driving me absolutely nuts.  Any further help is solving this would be deeply appreciated.

Brian

Categories:
I have the same question (0)
  • SebS Profile Picture
    4,742 Super User 2026 Season 1 on at

    @Brian_S 

     

    Collection require records or tables so Your collection do not work and throwing errors

    if I get it right PoP are 3 dates and Rate is the same for each date at last that how it look at your form.

     

    The collection will collect a record what will store Date and rate as below

     

    Than You use For all in not best way for efficiency but should work as you intend it will create a record for each collected PoP than in the SP record You will get each collected date in the PoP by referring to NewPop.Date and NewPoP.Rate the NewPop is an alias to make sure Power FX is not confused and know what to look for.

     

     

    Clear(PoP);
    Collect(PoP,{Date:'txtPop.Text',Rate:'txtRate.Text'});
    Collect(PoP,{Date:'txtPop_1.Text',Rate:'txtRate.Text'});
    Collect(PoP,{Date:'txtPop_2.Text',Rate:'txtRate.Text'});
    ForAll(PoP As NewPoP,
    Patch('New Unanet Form List Test',
     Defaults('New Unanet Form List Test'),
     {
    
     Title:drpPriceModel.Selected.Value,
     Call Order:drpCallOrder.Selected.Value,
     Task:txtTask.Text,
     Position:txtPosition.Text,
     PoP:NewPoP.Date,
     Call Order Rate:NewPoP.Rate
    
    
     }
     )
    )

     

     

    I hope it will work I never test it inside of the app

  • Brian_S Profile Picture
    216 on at

    Hi Seb!

     

    Thanks you so much for your reply.  I tried it out and unfortunately it did not work.  I did give some bad info on my initial post (sorry about that).  The rate column is actually a currency column in the SP list and the PoP would be entered something like this in the field :01/01/23 - /2/23/24.

     

    I am sure I am screwing something up but I have checked the formula several times.  Brian

  • SebS Profile Picture
    4,742 Super User 2026 Season 1 on at

    @Brian_S 

     

    Could you provide errors what showing up ?

     

    Regards

  • Brian_S Profile Picture
    216 on at

    Hi Seb, there are 61 errors.  I pasted the formula below I am using.  In the original formula it was Rate in the Collect formulas but the Column is titled Call Order Rate so I was thinking that was it.  Also, I do not have a Date column anywhere, but then again don't know if that will do anything.  

     

    I did take a screen shot of some of the errors.  Thank you so much again for your help!

     

    Clear(PoP);
    Collect(PoP,{Date:'txtPop.Text',Call Order Rate:Value(txtRate.Text'});
    Collect(PoP,{Date:'txtPop_1.Text',Call Order Rate:Value(txtRate.Text'});
    Collect(PoP,{Date:'txtPop_2.Text',Call Order Rate:Value(txtRate.Text'});
    ForAll(PoP As NewPoP,
    Patch('New Unanet Form List Test',
    Defaults('New Unanet Form List Test'),
    {

    Title:drpPriceModel.Selected.Value,
    Call Order:drpCallOrder.Selected.Value,
    Task:txtTask.text,
    Position:txtPosition.text,
    PoP:NewPoP.Date,
    Call Order Rate:NewPoP.Rate


    }
    )
    )

     

    Brian_S_0-1683906822812.png

     

  • SebS Profile Picture
    4,742 Super User 2026 Season 1 on at

    @Brian_S 

     

    You need to make sure Column Names are matching so double check I notice in SP List You showing column rate but in Your formula You calling it Call Order Rate

     

    Code below is tested by me and You need to check right column name and replace Rate with it in the code

     

    Clear(PoP);
    Collect(
     PoP,
     {
     Date: 'txtPop.Text',
     Rate: 'txtRate.Text'
     }
    );
    Collect(
     PoP,
     {
     Date: 'txtPop_1.Text',
     Rate: 'txtRate.Text'
     }
    );
    Collect(
     PoP,
     {
     Date: 'txtPop_2.Text',
     Rate: 'txtRate.Text'
     }
    );
    ForAll(
     PoP As NewPoP,
     Patch(
     'New Unanet Form List Test',
     Defaults('New Unanet Form List Test'),
     {
     Title: drpPriceModel.Selected.Value,
     'Call Order': drpCallOrder.Selected.Value,
     Task: txtTask.Text,
     Position: txtPosition.Text,
     PoP:NewPoP.Date.Text,
     Rate:Value(NewPoP.Rate.Text)
     }
     )
    )

     

  • Brian_S Profile Picture
    216 on at

    Hi Seb.  I copied the formula word for word and updated the "Rate" to read "Call Order Rate".  Sadly its giving me 69 errors, most of them being unexpected characters, expected operator, expected colon, etc.).  I am very sorry this is such a pain.

     

     

    Clear(PoP);
    Collect(
    PoP,
    {
    Date:txtPop.Text
    Call Order Rate:txtRate.Text
    }
    );
    Collect(
    PoP,
    {
    Date:txtPop_1.Text
    Call Order Rate:txtRate.Text
    }
    );
    Collect(
    PoP,
    {
    Date:txtPop_2.Text
    Call Order Rate:txtRate.Text
    }
    );
    ForAll(
    PoP As NewPoP,
    Patch(
    'New Unanet Form List Test',
    Defaults('New Unanet Form List Test'),
    {
    Title: drpPriceModel.Selected.Value,
    'Call Order': drpCallOrder.Selected.Value,
    Task: txtTask.Text,
    Position: txtPosition.Text,
    PoP:NewPoP.Date.Text,
    Call Order Rate:Value(NewPoP.Rate.Text)
    }
    )
    )

  • Verified answer
    SebS Profile Picture
    4,742 Super User 2026 Season 1 on at

    @Brian_S 

     

    Don't worry i need to be more specific on instructions heheh so the fault is on my side 🙂

     

    Rate in Patch should be changed from Rate: to 'Call Order Rate': You should not tach the collection 🙂

    also if your column name have space between words you need to wrap name in ' ' 

     

    try below

     

     

    Clear(PoP);
    Collect(
     PoP,
     {
     Date: 'txtPop.Text',
     Rate: 'txtRate.Text'
     }
    );
    Collect(
     PoP,
     {
     Date: 'txtPop_1.Text',
     Rate: 'txtRate.Text'
     }
    );
    Collect(
     PoP,
     {
     Date: 'txtPop_2.Text',
     Rate: 'txtRate.Text'
     }
    );
    ForAll(
     PoP As NewPoP,
     Patch(
     'New Unanet Form List Test',
     Defaults('New Unanet Form List Test'),
     {
     Title: drpPriceModel.Selected.Value,
     'Call Order': drpCallOrder.Selected.Value,
     Task: txtTask.Text,
     Position: txtPosition.Text,
     PoP:NewPoP.Date.Text,
     'Call Order Rate':Value(NewPoP.Rate.Text)
     }
     )
    )

     

     

  • Verified answer
    Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @SebS - I think this thread is related to:

     

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Having-multiple-lines-in-a-Data-Card-create-new-record-on-new/m-p/2142508#M536015 

     

    @Brian_S - going to drop out of the other thread and assume you no longer require support.

  • Brian_S Profile Picture
    216 on at

    @Amik and @SebS 

     

    You both are rockstars!  It worked.  I had to do some messing around with all the formulas, but Amik's your worked like a charm.  Seb if it wasn't for you explaining the '' I would never have done it.  I cannot think you enough.  Thank you both so much!!  As I continue finalizing this form I hope to goodness I don't have any more questions 🙂  Have a great weekend!!

  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    Your welcome @Brian_S .

     

    Please mark @SebS - response as the Solution and not my response.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 85

#2
WarrenBelz Profile Picture

WarrenBelz 76 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard