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

Split or Distinct Number with differentiator number

Hi all..

I want to distinct a number row that i get from a barcode scanner, the problem is shown below:

 

Example case:
0188445051546172202810K1527906
24088445051546172202810K1527906


What should i do to distinct it into these numbers:
Part 1 = 88445051546
Part 2 = 22028
Part 3 = K1527906

The differentiator is in the bold one, 01 or 240, 17, 10

 

Also, can i do it with variable instead of a collection?
Please help.

 

Thanks,

pytbyt

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Split or Distinct Number with differentiator number

Hey @PytByt 

 

Can you try out the below expressions:
 
If the differentiators will not exist in the returned number, then you can use below expression:
 
Part1: Set(Part1, Last(FirstN(Split(Substitute(Substitute(Substitute(Substitute(Label7.Text,"01",";"),"240",";"),"17",";"),"10",";"),";"),2)).Result)
 
Part2: Set(Part2,First(LastN(Split(Substitute(Substitute(Substitute(Substitute(Label7.Text,"01",";"),"240",";"),"17",";"),"10",";"),";"),2)).Result)
 
Part3: Set(Part3,Last(Split(Substitute(Substitute(Substitute(Substitute(Label7.Text,"01",";"),"240",";"),"17",";"),"10",";"),";")).Result)
 
In case, the number of characters in the returned string will be same, you can use:
 
Part1: Set(Part1, Mid(Label7.Text,2,12))
Part2: Set(Part2, Mid(Label7.Text,16,5))
Part3: Set(Part3, Mid(Label7.Text,23,8))
 
You need to replace Label7.Text with the control/field returning the value.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
 

View solution in original post

2 REPLIES 2
Dual Super User
Dual Super User

Re: Split or Distinct Number with differentiator number

Hey @PytByt 

 

Can you try out the below expressions:
 
If the differentiators will not exist in the returned number, then you can use below expression:
 
Part1: Set(Part1, Last(FirstN(Split(Substitute(Substitute(Substitute(Substitute(Label7.Text,"01",";"),"240",";"),"17",";"),"10",";"),";"),2)).Result)
 
Part2: Set(Part2,First(LastN(Split(Substitute(Substitute(Substitute(Substitute(Label7.Text,"01",";"),"240",";"),"17",";"),"10",";"),";"),2)).Result)
 
Part3: Set(Part3,Last(Split(Substitute(Substitute(Substitute(Substitute(Label7.Text,"01",";"),"240",";"),"17",";"),"10",";"),";")).Result)
 
In case, the number of characters in the returned string will be same, you can use:
 
Part1: Set(Part1, Mid(Label7.Text,2,12))
Part2: Set(Part2, Mid(Label7.Text,16,5))
Part3: Set(Part3, Mid(Label7.Text,23,8))
 
You need to replace Label7.Text with the control/field returning the value.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
 

View solution in original post

PytByt
Level 8

Re: Split or Distinct Number with differentiator number

Hey @yashag2255 

I'm so happy to see your reply. It works for my cases.


Edit:

Anyhow, what should i do to make it work with Part 2 and 3 is blank?
For example:

From this:
0123456789 or 24023456789
and
172202810K1527906

To this:
Part 1 = 0123456789 or 24023456789
Part 2 = Not Exist
Part 3 = Not Exist

And

To This:
Part 1 = Not Exist

Part 2 = Not Exist
Part 3 = 10K1527906

I have figure out that i have the same problem with this one here and here. Is there any way to read Hexa in powerApps? How?

Thanks,

BR.

PytByt

 

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 332 members 6,569 guests
Please welcome our newest community members: