cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ilu989
Level: Powered On

Get the integer from the integer and duplicate the integer

Hi Everyone,

 

I got two simple questions while creating the Flow:

 

A. I would like to get the integer number from the string, ex:

Input AB1738

Output 1738

I know use skip expression can do it, like this @{skip('AB1738', 2)}, but the design of input is variation by different times, some time input will become A1738, so skip is not suitable for my case, any idea can share?

 

B. The other issue about the duplicate data, I want to duplicate the data for 3 times, ex:

Input: 2019-11-16T01:12:22.5967458Z

Output: 2019-11-16T01:12:22.5967458Z, 2019-11-16T01:12:22.5967458Z, 2019-11-16T01:12:22.5967458Z

Is it possible?

 

Please help on these, thank you.

Regards,

ilu989

3 ACCEPTED SOLUTIONS

Accepted Solutions
SamPo
Level 10

Re: Get the integer from the integer and duplicate the integer

@ilu989 

If anyone has an easier way to do this then I'm all ears but this is what I've got for you:

 

I started by entering your test string and then calculating it's length 

Screenshot 2019-11-17 at 20.28.44.png

length(outputs('String'))

 Then add the following 3 variables:

Screenshot 2019-11-17 at 20.30.36.png

 Then add the following 'do-until' of 'counter = outputs('Length')'

Screenshot 2019-11-17 at 20.32.02.png

 

substring(outputs('String'),variables('Counter'),1)

Here's the inner condition:

Screenshot 2019-11-17 at 20.34.29.png

 

contains(variables('Numbers'),outputs('SubString'))

outputs('SubString')

After the 'do until' run an 'apply to each' on the 'Numbers Result Array' and append each number to the 'Final Results String' variable. Then I just used the last compose to display the result:

Screenshot 2019-11-17 at 20.36.20.png

 

If you find an easier way of doing this then please let me know but I can't think of one at the moment. 

For your second question of duplication, you can just add the same variable/dynamic content 3 times.

 

If I have answered your question then please consider marking this post as a solution and a thumbs up!

 

Sam

View solution in original post

Super User
Super User

Re: Get the integer from the integer and duplicate the integer

@ilu989 

While your question is simple, the answer is not....

Below is another solution to your issue breaking apart the string and capturing only the integers.  I loop through each element of the string and try to convert it to an integer.  If it fails, I just move on to the next element.  This is facilitated by the run after setting.  The final compose action is just so that you can see the result.

IntOnly1.jpgIntOnly2.jpgIntOnly3.jpgIntOnly4.jpgIntOnly5.jpgIntOnly6.jpgIntOnly7.jpg

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

Super User
Super User

Re: Get the integer from the integer and duplicate the integer

@ilu989 

In answer to your second question regarding the dates/times, you can use the concat() expression - see my example below:

IntOnly8.jpg

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

3 REPLIES 3
SamPo
Level 10

Re: Get the integer from the integer and duplicate the integer

@ilu989 

If anyone has an easier way to do this then I'm all ears but this is what I've got for you:

 

I started by entering your test string and then calculating it's length 

Screenshot 2019-11-17 at 20.28.44.png

length(outputs('String'))

 Then add the following 3 variables:

Screenshot 2019-11-17 at 20.30.36.png

 Then add the following 'do-until' of 'counter = outputs('Length')'

Screenshot 2019-11-17 at 20.32.02.png

 

substring(outputs('String'),variables('Counter'),1)

Here's the inner condition:

Screenshot 2019-11-17 at 20.34.29.png

 

contains(variables('Numbers'),outputs('SubString'))

outputs('SubString')

After the 'do until' run an 'apply to each' on the 'Numbers Result Array' and append each number to the 'Final Results String' variable. Then I just used the last compose to display the result:

Screenshot 2019-11-17 at 20.36.20.png

 

If you find an easier way of doing this then please let me know but I can't think of one at the moment. 

For your second question of duplication, you can just add the same variable/dynamic content 3 times.

 

If I have answered your question then please consider marking this post as a solution and a thumbs up!

 

Sam

View solution in original post

Super User
Super User

Re: Get the integer from the integer and duplicate the integer

@ilu989 

While your question is simple, the answer is not....

Below is another solution to your issue breaking apart the string and capturing only the integers.  I loop through each element of the string and try to convert it to an integer.  If it fails, I just move on to the next element.  This is facilitated by the run after setting.  The final compose action is just so that you can see the result.

IntOnly1.jpgIntOnly2.jpgIntOnly3.jpgIntOnly4.jpgIntOnly5.jpgIntOnly6.jpgIntOnly7.jpg

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

Super User
Super User

Re: Get the integer from the integer and duplicate the integer

@ilu989 

In answer to your second question regarding the dates/times, you can use the concat() expression - see my example below:

IntOnly8.jpg

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

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