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

What's wrong with my filtering code?

So, basically I am trying to filter invoice numbers, they have a pattern/rule:

Their length is 9 characters, the first character is always an alphabet and characters 3-8 are numbers between 0-9.

'I modified the code given by @Paulie78 on an earlier answer for the same:

 

@and(
or
(
equals(substring(item(), 0,1),'A'), 
equals(substring(item(), 0,1),'B'),
equals(substring(item(), 0,1), 'C'),
equals(substring(item(), 0,1), 'D'),
equals(substring(item(), 0,1), 'E'),
equals(substring(item(), 0,1), 'F'),
equals(substring(item(), 0,1), 'G'),
equals(substring(item(), 0,1), 'H'),
equals(substring(item(), 0,1), 'I'),
equals(substring(item(), 0,1), 'J'),
equals(substring(item(), 0,1), 'K'),
equals(substring(item(), 0,1), 'L'),
equals(substring(item(), 0,1), 'M'),
equals(substring(item(), 0,1), 'N'),
equals(substring(item(), 0,1), 'O'),
equals(substring(item(), 0,1), 'P'),
equals(substring(item(), 0,1), 'Q'),
equals(substring(item(), 0,1), 'R'),
equals(substring(item(), 0,1), 'S'),
equals(substring(item(), 0,1), 'T'),
equals(substring(item(), 0,1), 'U'),
equals(substring(item(), 0,1), 'V'),
equals(substring(item(), 0,1), 'W'),
equals(substring(item(), 0,1), 'X'),
equals(substring(item(), 0,1), 'Y'),
equals(substring(item(), 0,1), 'Z') 
), 
or
(
equals(substring(item(), 3,1),'1'), equals(substring(item(), 3,1),'2'),
equals(substring(item(), 3,1), '3'),
equals(substring(item(), 3,1), '4'),
equals(substring(item(), 3,1), '5'),
equals(substring(item(), 3,1), '6'),
equals(substring(item(), 3,1), '7'),
equals(substring(item(), 3,1), '8'),
equals(substring(item(), 3,1), '9')
),
or
(
equals(substring(item(), 4,1), '0'),
equals(substring(item(), 4,1), '1'),
equals(substring(item(), 4,1), '2'),
equals(substring(item(), 4,1), '3'),
equals(substring(item(), 4,1), '4'),
equals(substring(item(), 4,1), '5'),
equals(substring(item(), 4,1), '6'),
equals(substring(item(), 4,1), '7'),
equals(substring(item(), 4,1), '8'),
equals(substring(item(), 4,1), '9')
),
or
(
equals(substring(item(), 5,1), '0'),
equals(substring(item(), 5,1), '1'),
equals(substring(item(), 5,1), '2'),
equals(substring(item(), 5,1), '3'),
equals(substring(item(), 5,1), '4'),
equals(substring(item(), 5,1), '5'),
equals(substring(item(), 5,1), '6'),
equals(substring(item(), 5,1), '7'),
equals(substring(item(), 5,1), '8'),
equals(substring(item(), 5,1), '9')
),
or
(
equals(substring(item(), 6,1), '0'),
equals(substring(item(), 6,1), '1'),
equals(substring(item(), 6,1), '2'),
equals(substring(item(), 6,1), '3'),
equals(substring(item(), 6,1), '4'),
equals(substring(item(), 6,1), '5'),
equals(substring(item(), 6,1), '6'),
equals(substring(item(), 6,1), '7'),
equals(substring(item(), 6,1), '8'),
equals(substring(item(), 6,1), '9')
),
or
(
equals(substring(item(), 7,1), '0'),
equals(substring(item(), 7,1), '1'),
equals(substring(item(), 7,1), '2'),
equals(substring(item(), 7,1), '3'),
equals(substring(item(), 7,1), '4'),
equals(substring(item(), 7,1), '5'),
equals(substring(item(), 7,1), '6'),
equals(substring(item(), 7,1), '7'),
equals(substring(item(), 7,1), '8'),
equals(substring(item(), 7,1), '9')
),
or
(
equals(substring(item(), 8,1), '0'),
equals(substring(item(), 8,1), '1'),
equals(substring(item(), 8,1), '2'),
equals(substring(item(), 8,1), '3'),
equals(substring(item(), 8,1), '4'),
equals(substring(item(), 8,1), '5'),
equals(substring(item(), 8,1), '6'),
equals(substring(item(), 8,1), '7'),
equals(substring(item(), 8,1), '8'),
equals(substring(item(), 8,1), '9')
)
)

 

 

The flow looks like this:

FlowFlow

 Results:

1.png

 

2.png

 

Why is it not returning EW2000087 and Z1C000542? 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PrasadAthalye
Super User
Super User

Can you include 0 in this part of the expression and see if it works?

 

or
(
equals(substring(item(), 3,1),'1'), equals(substring(item(), 3,1),'2'),
equals(substring(item(), 3,1), '3'),
equals(substring(item(), 3,1), '4'),
equals(substring(item(), 3,1), '5'),
equals(substring(item(), 3,1), '6'),
equals(substring(item(), 3,1), '7'),
equals(substring(item(), 3,1), '8'),
equals(substring(item(), 3,1), '9')
),
Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

View solution in original post

2 REPLIES 2
PrasadAthalye
Super User
Super User

Can you include 0 in this part of the expression and see if it works?

 

or
(
equals(substring(item(), 3,1),'1'), equals(substring(item(), 3,1),'2'),
equals(substring(item(), 3,1), '3'),
equals(substring(item(), 3,1), '4'),
equals(substring(item(), 3,1), '5'),
equals(substring(item(), 3,1), '6'),
equals(substring(item(), 3,1), '7'),
equals(substring(item(), 3,1), '8'),
equals(substring(item(), 3,1), '9')
),
Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

View solution in original post

yashm
Helper II
Helper II

Ah yes! Completely missed it. Side effects of working late I guess 😅. Thank you Prasad!

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (2,421)