cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User II
Super User II

@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
Super User II
Super User II

@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

Helper I
Helper I

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

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (13,533)