cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Spassler
Helper II
Helper II

BeginsWith and Contains Issues when using an IF statement

So below is my Code. and the BeginsWith and Contains error out and say: "Expected operator. We expect an operator such as +, *, or & at t his point in the formula."

 

I don't see where those or any other operator would work? Is what I'm doing just not possible?

 

If(JobPrefix.Selected.Value BeginsWith("C") And JobSuffix.Selected.Value Contains("T&M"), First(Sort(ProjectInformationSheet,'Auto Number',Descending).'Auto Number').'Auto Number'+1)

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User III
Super User III

Hi @Spassler 

BeginsWith and Contains are not Power Apps functions.

They are enumeration/special keywords for use with the IsMatch function.

https://docs.microsoft.com/en-gb/powerapps/maker/canvas-apps/functions/function-ismatch

 

The functions that you're looking for are StartsWith and in. The formula beneath should be closer to what you want:

If(StartsWith(JobPrefix.Selected.Value, "C") 
     And ("T&M" in JobSuffix.Selected.Value), 
   First(Sort(ProjectInformationSheet,'Auto Number',Descending).'Auto Number').'Auto Number'+1
)

View solution in original post

3 REPLIES 3
timl
Super User III
Super User III

Hi @Spassler 

BeginsWith and Contains are not Power Apps functions.

They are enumeration/special keywords for use with the IsMatch function.

https://docs.microsoft.com/en-gb/powerapps/maker/canvas-apps/functions/function-ismatch

 

The functions that you're looking for are StartsWith and in. The formula beneath should be closer to what you want:

If(StartsWith(JobPrefix.Selected.Value, "C") 
     And ("T&M" in JobSuffix.Selected.Value), 
   First(Sort(ProjectInformationSheet,'Auto Number',Descending).'Auto Number').'Auto Number'+1
)

View solution in original post

TheRobRush
Impactful Individual
Impactful Individual

Might try something like this

If(
   And(
       StartsWith(JobPrefix.Selected.Value,"C"), 
       "T&M" in JobSuffix.Selected.Value), 
               First(Sort(ProjectInformationSheet,'Auto Number',Descending).'Auto Number').'Auto Number'+1)

 

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

@TheRobRush @timl 

 

Thanks guys good to know! i was wracking my brain trying to figure out what was wrong with it haha.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (4,057)