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 / Create or Update if ex...
Power Apps
Answered

Create or Update if exist a row

(0) ShareShare
ReportReport
Posted on by 504

I have this code but only updates a row if a row does not work, so I used if statement and lookup if exist it will patch if not collect. But seems it's not working. 

 

If(LookUp('ItemList', Title = ID.Text),
Patch(ItemList, LookUp('ItemList', Title = ID.Text), {
 Title: ID.Text,
 ENM: ENM.Text, 
 CNM: CNM.Text,
 }),

Collect(ItemList, {
 Title: ID.Text,
 ENM: ENM.Text, 
 CNM: CNM.Text,}))


Is this okay to use or is there another way of doing this? Thanks 

Categories:
I have the same question (0)
  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at

    @nagestiada 
    You are simply missing the logical comparison in the 1st argument of your IF statement.


    If(
        !IsBlank(LookUp('ItemList', Title = ID.Text)),

        Patch(ItemList, LookUp('ItemList', Title = ID.Text), {
        Title: ID.Text,
        ENM: ENM.Text,
        CNM: CNM.Text,
        }),

        Collect(ItemList, {
        Title: ID.Text,
        ENM: ENM.Text,
        CNM: CNM.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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard