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 Apps
Answered

Left function

(1) ShareShare
ReportReport
Posted on by 65

The following code gets a string given form a barcode scanner that returns a sort of different strings, with and without letters. This way it works perfectly fine and don´t return the values that starts with A, B and D.

 

If((Left(varScan;1) <> "A" || Left(varScan;1) <> "B" || Left(varScan;1) <> "D"; varScan; Parent.Default)

 

The problem occurs when I try to add two mode conditions that is expected to exclude values that starts with 6 and 9. The code below is not working, beacuse it returns 6 and 9 started strings.

 

If((Left(varScan;1) <> "A" || Left(varScan;1) <> "B" || Left(varScan;1) <> "D" || Left(varScan;1) <> "6" || Left(varScan;1) <> "9"); varScan; Parent.Default)

 

Thank you in advance!

Categories:
I have the same question (0)
  • Verified answer
    poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @BrosJr 

    The issue in your formula is due to the use of the OR operator (||) between the conditions.

    If you want to exclude values that start with "A", "B", "D", "6", or "9", you should use the AND operator (&&) instead of OR.

    The use of OR is returning true because if the first character is not "A", it's true that it's not "A" and the condition is satisfied regardless of the other checks.

     

    Here's the corrected formula:

    If(
     Left(varScan, 1) <> "A" &&
     Left(varScan, 1) <> "B" &&
     Left(varScan, 1) <> "D" &&
     Left(varScan, 1) <> "6" &&
     Left(varScan, 1) <> "9", 
     varScan, 
     Parent.Default
    )

     This formula should check that the first character is not "A", "B", "D", "6", or "9" and only then returns varScan. If any of these conditions are not met, it returns Parent.Default.

     

    Because you exclude  (<>) you should use &&. If it were include (=), then you might use || instead

  • BrosJr. Profile Picture
    65 on at

    Thank you! 💜

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 883

#2
Valantis Profile Picture

Valantis 571

#3
11manish Profile Picture

11manish 477

Last 30 days Overall leaderboard