cancel
Showing results for
Did you mean:

## 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?

Regards,

ilu989

3 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Impactful Individual

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

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

``length(outputs('String'))``

Then add the following 3 variables:

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

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

Here's the inner condition:

``````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:

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

Highlighted
Super User III

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

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.

If you like my response, please give it a Thumbs Up.

Scott
Highlighted
Super User III

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

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

If you like my response, please give it a Thumbs Up.

Scott
3 REPLIES 3
Highlighted
Impactful Individual

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

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

``length(outputs('String'))``

Then add the following 3 variables:

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

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

Here's the inner condition:

``````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:

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

Highlighted
Super User III

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

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.

If you like my response, please give it a Thumbs Up.

Scott
Highlighted
Super User III

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

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

If you like my response, please give it a Thumbs Up.

Scott

Announcements

#### August 2020 CYST Winners!

Check out the winners of the recent 'Can You Solve These?' community challenge!

#### Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

#### Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

#### Power Automate Community User Group Member Badge

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

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