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 / insert data into anoth...
Power Apps
Unanswered

insert data into another table

(0) ShareShare
ReportReport
Posted on by 24

hello guys,

 

I am trying to realize below scenario:

 

User has a list of items from one table, the main goal is to give him a possibility to approve selected item. Approval is equivalent to execution insert a record to another table. If one item was already approved then there should not be possibility to execute another insert for this item, so we also need to check somehow is there already existing row for selected item.

 

how it could be handled in power apps?

 

Thank you in advance for any help!

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    @jacob_ ,

    Fairly broad question, but you would use the Patch() statement, but first use LookUp to check if a record exists.

    Happy to help with reviewing your code after you have posted it.

     

    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.

  • jacob_ Profile Picture
    24 on at

    hello Warren, thank you for your reply. 

     

    I know both functions, but as I wrote I want to display data from one data source and based on selected item I need to execute insert into another table.. I don't think It is possible from one gallery where I display data or am I wrong? 

     

    best regards!

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

    Hi @jacob_ ,

    Can you please explain in a bit more detail what you are trying to do here. As long as the item displayed has a "matching" field with the second data source, you can check if the matching record is there and if not create one?

  • jacob_ Profile Picture
    24 on at

    yes, something like that. If there is matching record for selected item from first table in second table display "status: approved" if not then show button which will insert record with associated attributes for selected item from first table to the second table.   

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

    @jacob_ ,

    That is what I thought - wat code have you attempted on this - please post in Text.

  • jacob_ Profile Picture
    24 on at

    to be honest I don't have any working code because I do not know how to approach this. I am looking for some guidance or even confirmation if it is possible

     

    thanks again and best regards

  • vish3027 Profile Picture
    434 on at

    @Anonymous 

     

    What are other possible statuses other than Approved and what happened on those statuses.

    You need atleast one column common in both places. Here you can use Item ID your parent list and have RefID column in another table and on Patch you can update this column as well.

     

    Now, before inserting record in another table

    You can check LookUp(anotherlist, RefID=curritemID && Status="approved") if this returns record then dont insert else insert record.

     

    Please try this and let me know if this works for you.

  • Verified answer
    WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    @jacob_ ,

    I cannot start writing accurate code without knowing at least your values (list and field names). I am happy to guide you through the process and the syntax required - I will give you a pattern, but need you to have a attempt to put values in it. To check for existing record and then Patch

    If(
     IsBlank(
     LookUp(
     YourTargetList,
     YourReferenceField = ValueYouAreChecking
     ).AnyFieldNameInList
     ),
     Patch(
     YourTargetList,
     Defaults(
     YourTargetList,
     {
     Field1:YourValue1,
     Field2:YourValue2,
     . . . . .
     }
     )
     )
    )

     

    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.

     

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