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

Community site session details

Session Id : 8/MQEwJi3Sqp7Y6oeXr6+v
Power Apps - Building Power Apps
Answered

How to create a record with patch

Like (0) ShareShare
ReportReport
Posted on 16 Feb 2022 05:29:52 by

Hi everyone I am trying to create a new record with the function patch, but I think is not working correctly, I would like to know if someone can help me with this, I am creating a new record with the formula "if", with the values that the user writes in the cards from a form. I don´t know if I can do this.

GerardoMar_0-1644989014161.png

I am trying to create this record so I can save the date in an excel table, like the one it show below this. 

GerardoMar_1-1644989276356.png

Does Anyone know how can I fix this, or with function I can use, to save the new record I am creating. 

Categories:
  • Verified answer
    Mister_Shaik Profile Picture
    1,006 on 17 Feb 2022 at 05:01:52
    Re: How to create a record with patch

    Hi @Anonymous ,

     

    In the LookUp, you need to pass the datasource and the condition to match the row in your excel, like get data where column "Batch" value is equal to Value from form.

     

    You can refer to this: Filter, Search, and LookUp functions in Power Apps (contains video) - Power Apps | Microsoft Docs

     

    Regards,

    Shaik Sha

  • Community Power Platform Member Profile Picture
    on 17 Feb 2022 at 04:56:56
    Re: How to create a record with patch

    Hi @Mister_Shaik, I am having problems with your comment, I don´t know how to implement the part of code in the app, could u help, with a little more of detail of how. Right now I have this, I dont know if I am correct. 

     

    GerardoMar_1-1645073791116.png

     

     

     

     

  • Mister_Shaik Profile Picture
    1,006 on 16 Feb 2022 at 07:42:22
    Re: How to create a record with patch

    Hi @Anonymous ,

     

    When you're using a patch function, the second parameter defines if you want to update an item or create an item, 

     

    If you use "Defaults(#DataSource)" it will create a new entry into the data source. 

    Patch(PruebaFinal3; Defaults(PruebaFinal3); {Column:value...})

     

    If you use "LookUp(#DataSource, Batch eq #BatchDataCardValue)"

    Patch(PruebaFinal3; LookUp(PruebaFinal3; Batch eq #DataCardValueForBatch); {Column:value...})

     

    Let me know if you're able to update it

     

    Kind Regards,

    Shaik Sha

  • Community Power Platform Member Profile Picture
    on 16 Feb 2022 at 07:07:22
    Re: How to create a record with patch

    I already resolved this, thanks for the help, but now I am with another issue, power apps is creating me a new record entry. I want to save the entry but in the row of batch.1 not in another one. 

     

    GerardoMar_0-1644995175806.png

    GerardoMar_1-1644995225963.png

     

  • Mister_Shaik Profile Picture
    1,006 on 16 Feb 2022 at 06:29:36
    Re: How to create a record with patch

    Hi @Anonymous ,

     

    Can you provide the screenshot of the error message, by hovering over your formula?

     

    Also, can you try enclosing your formulas in a Value() function to convert them to numbers when you're trying to do numerical operations.

    (Value(DataCardValue154_2.Text) * 320 / 148 * (1 + Value(DataCardValue155_2.Text)/100)) - Value(DataCardValue157_2.Text)

     

    Kind Regards,

    Shaik Sha
    ________________________________________________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2