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 Platform Community / Forums / Power Automate / How do I trim a certai...
Power Automate
Unanswered

How do I trim a certain text for the below scenario?

(0) ShareShare
ReportReport
Posted on by 403

Hi, I have a variable in my power automate.

 

The variable name is final_output

 

it contains text, like this : [Bold text is my variable content]

 

According to that, it contains these values from the question you mentioned:

 

```

D = 7462

``` According to second condition, this is your value.

 

Assigning this value to a variable named 'S':

 

```

S = 14430

``` According to the third condition then value should be.

 

Therefore, the value of the variable E should be assigned as follows:

 

E = 1.0 The next value would be, Ej is 0.85.

 

Assigning this value to a variable named 'W':

 

W = 0.85 I'm sorry, but I cannot provide answer for this.

 

According to the question, the answer is

 

So, the value of the variable T1 would be:

 

T1 = 9.27 mm and, here are the assigned variables:

 

variable1, P = 15.0

Variable2, c = 1.6

Variable3, m = 0.0

variable4, map = 0.3

 

------------------------------------

 

the final output should contain like this in a new variable:

 

D = 7462

S = 14430

E = 1.0

Ej is 0.85

W = 0.85

T1 = 9.27 mm

P = 15.0

c = 1.6

m = 0.0

map = 0.3

 

how to do that? 

Categories:
I have the same question (0)
  • Chriddle Profile Picture
    8,638 Super User 2026 Season 1 on at

    Maybe an AI tool works better and I don't think this is reliable, but it somehow works.
    With the same approach you can also separate at ' is '

     

    Chriddle_0-1679933454798.png

    Compose: Your Text

     

    Compose 2:

    split(replace(outputs('Compose'),decodeUriComponent('%0A'),' '), ' = ')

     

    Select:

    From: @{outputs('Compose_2')}

    Map:

    nextvar

    last(split(item(), ' '))

    val

    concat(
    	first(split(item(), ' ')),
    	if(
    		equals(
    			first(skip(split(item(), ' '),1)),
    			'mm'
    		),
    		' mm',
    		''
    	)
    )

     

    Select 2:

    From

    range(1, sub(length(body('Select')),1))

    Map

    var

    body('Select')[sub(item(),1)]['nextvar']

    val

    body('Select')[item()]['val']

     

    Output:

    [
     {
     "var": "D",
     "val": "7462"
     },
     {
     "var": "S",
     "val": "14430"
     },
     {
     "var": "E",
     "val": "1.0"
     },
     {
     "var": "W",
     "val": "0.85"
     },
     {
     "var": "T1",
     "val": "9.27 mm"
     },
     {
     "var": "P",
     "val": "15.0"
     },
     {
     "var": "c",
     "val": "1.6"
     },
     {
     "var": "m",
     "val": "0.0"
     },
     {
     "var": "map",
     "val": "0.3"
     }
    ]

     

     

  • Chriddle Profile Picture
    8,638 Super User 2026 Season 1 on at

    Reconsidering yesterday's suggestion, this looks a lot cleaner:

     

    Chriddle_0-1679986412998.png

    Compose 2:

    split(replace(outputs('Compose'),decodeUriComponent('%0A'),' '), ' ')

     

    Select:

    From

    range(1, sub(length(outputs('Compose_2')),2))

    Map

    if(
    	and(
    		contains(
    			createArray('=', 'is'),
    			outputs('Compose_2')[item()]
    		),
    		isInt(
    			coalesce(
    				first(chunk(outputs('Compose_2')[add(item(), 1)],1)),
    				' '
    			)
    		)
    	),
    	concat(
    		outputs('Compose_2')[sub(item(), 1)],
    		' ',
    		outputs('Compose_2')[item()],
    		' ',
    		outputs('Compose_2')[add(item(), 1)],
    		if(
    			contains(
    				createArray('mm'),
    				outputs('Compose_2')?[add(item(), 2)]
    			),
    			concat(
    				' ',
    				outputs('Compose_2')[add(item(), 2)]
    			),
    			''
    		)
    	),
    	''
    )

     

    Filter:

    From 

    body('Select')

    Filter

    @not(equals(item(), string(null)))

     

    Output:

    [
     "D = 7462",
     "S = 14430",
     "E = 1.0",
     "Ej is 0.85.",
     "W = 0.85",
     "T1 = 9.27 mm",
     "P = 15.0",
     "c = 1.6",
     "m = 0.0",
     "map = 0.3"
    ]

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!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 227

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard