cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MarcBailey
Level 8

If(LookUp...) Need syntax help...

Need help  --  I am having problems with the syntax for the following scenario:

 

I need to look in SharePoint list and see if the Account exist and if not create a new Record, as well as navigate if it is or isn't.

1) If SharePointList.Title = CurrentID is true then Navigate to Screen2

2) If SharePointList.Title = CurrentID is false then create a new record in SharePointList with Title column = CurrentID then Navigate to Screen2.

 

OnSelect:

If(LookUp(SharePointList,Column2 = CurrentID, Navigate(Screen2, ScreenTransition.None)), Patch(SharePointList, {Title: CurrentID})

The Navigate and Patch function happen regardless if the condition is met or not.

I would really appreciate some help on this.

Thanks, Marc

1 ACCEPTED SOLUTION

Accepted Solutions
Mike8
Level 10

Re: If(LookUp...) Need syntax help...

Hello MarcBailey,

You can try this formula:

If(IsBlank(LookUp(SharePointList,Title=CurrentID,Title)),
Collect(SharePointList ,{Title:CurrentID}));
Navigate(Screen2,ScreenTransition.None)


And something to help:

IsBlank(LookUp(SharePointList,Title=CurrentID,Title)) : true or false, if there is the CurrentID in SharePointList under the Title column or not.

Collect(SharePointList ,{Title:CurrentID}) : adds an other record at SharePointList but this new record has only one field, filled. Title: CurrentID (if you would like to fill more fields, you should add them next to the Title column)

Navigate(Screen2,ScreenTransition.None) is outside of If() function because you would like to navigate at that screen regardless the outcome of the LookUp()

View solution in original post

2 REPLIES 2
Mike8
Level 10

Re: If(LookUp...) Need syntax help...

Hello MarcBailey,

You can try this formula:

If(IsBlank(LookUp(SharePointList,Title=CurrentID,Title)),
Collect(SharePointList ,{Title:CurrentID}));
Navigate(Screen2,ScreenTransition.None)


And something to help:

IsBlank(LookUp(SharePointList,Title=CurrentID,Title)) : true or false, if there is the CurrentID in SharePointList under the Title column or not.

Collect(SharePointList ,{Title:CurrentID}) : adds an other record at SharePointList but this new record has only one field, filled. Title: CurrentID (if you would like to fill more fields, you should add them next to the Title column)

Navigate(Screen2,ScreenTransition.None) is outside of If() function because you would like to navigate at that screen regardless the outcome of the LookUp()

View solution in original post

Highlighted
MarcBailey
Level 8

Re: If(LookUp...) Need syntax help...

Hi Mike8,

 

Thanks for the help - much appreciated.  There so many different ways to code things and you can be so close but then so far away.

 

Thanks, Marc...

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,657)