cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Update if exist else collect - Collection

Hi,

I have created a button that will insert a row to a Collection. But I want to make sure that the same item/name can't be created.

So I need the following if statement:

If(ThisNameExistInTheCollection, ThenUpdate, ElseCollectNewRow)

I tried with the following expression, but it doesn't work in the right way:

 

seryil_0-1601033857970.png

 

Thank you in advance 🙂

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Update if exist else collect - Collection

@seryil 

 

Give a try with following formula:

If( IsBlank(LookUp(BudgetInput,EmployeeName=Gallery1.Selected.EmployeeName).EmployeeName),
Collect(BudgetInput, { EmployeeName:Gallery1.Selected.EmployeeName, Team: TextInput3_1.Text }),
Patch(BudgetInput,LookUp(BudgetInput,EmployeeName=Gallery1.Selected.EmployeeName),{ EmployeeName:Gallery1.Selected.EmployeeName, Team: TextInput3_1.Text }))

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

 

View solution in original post

2 REPLIES 2
Highlighted
Super User II
Super User II

Re: Update if exist else collect - Collection

@seryil 

 

Give a try with following formula:

If( IsBlank(LookUp(BudgetInput,EmployeeName=Gallery1.Selected.EmployeeName).EmployeeName),
Collect(BudgetInput, { EmployeeName:Gallery1.Selected.EmployeeName, Team: TextInput3_1.Text }),
Patch(BudgetInput,LookUp(BudgetInput,EmployeeName=Gallery1.Selected.EmployeeName),{ EmployeeName:Gallery1.Selected.EmployeeName, Team: TextInput3_1.Text }))

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

 

View solution in original post

Highlighted
Helper I
Helper I

Re: Update if exist else collect - Collection

Hi Seryil,

 

try the lookup function to check if the name is already in the datasource.

 

If(IsBlank(LookUp( BudgetInput;EmployeeName = Gallery1.Selected.EmployeeName ; EmployeeName ));UpdateIf(....);Collect(...))

 

Hope this helps!

 

Best

 

SwiPowE

Check out my YouTube Channel

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,938)