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 / Looking for a way to e...
Power Automate
Unanswered

Looking for a way to extract a piece of text to a variable

(0) ShareShare
ReportReport
Posted on by 32

I am looping through many xmls with the same structure but different number of rows. I need to extract number from such line.

<v:sampleDataSet dataSetName="990">

I have many identical lines (apart from the number) in each xml but I need to extract only the last one.

I only managed to save entire xml to a variable separated to lines with the action "read text from file".

I can set a variable from any line of this xml by using set variable action and referencing the the line number, but I don't know how to make reference to a variable line number - cause I repeat this operation for many files with different line count.

I have the same question (0)
  • Benny_1857 Profile Picture
    124 on at

    1. Input the text into variable1 ( I test <v:sample 110 DataSet 125 dataSet125Name="990.01">)

    2. Recognize  the entities by number for Variable1

        in this sample it will have 2 same columns 3 rows with number 110, 125, 990.01

    3. Launch a new excel and write it into A1

    4. Get the first freerow of the excelinstance

    5. ConditionLoop FirstFreeRow > 1

    6. DeleteRow from excel, 1st row

    7. Get FirstFreeRow again

    8. Decrease Variable by 1

    9. EndLoop

    10.Read A1 from Excel

    11.Close Excel without save

     

    Then you could set a bigger loop to include those steps

    Benny_1857_0-1642641148057.png

     

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Deleted

  • mktranslation Profile Picture
    32 on at

    Benny, thank you for this description. Although, I am afraid I didn't provide enough details. My xml has many different lines, and only some of them look like that. See the screenshot for reference.

    mktranslation_0-1642662982830.png

    I want to look for the last  <v:sampleDataSet dataSetName=

    in this case I need to extract:  935 to a variable.

  • mktranslation Profile Picture
    32 on at

    Benny, thank you for this description. Although, I am afraid I didn't provide enough details. My xml has many different lines, and only some of them look like that. See the screenshot for reference.

    mktranslation_1-1642663165744.png

     

    I want to look for the last  <v:sampleDataSet dataSetName=

    in this case I need to extract:  935 to a variable.

    I am afraid I can't loop in such a way - I already have a loop for each file. 

    My flow will go through many xmls each time saving each of them into one variable that will be used to other processes.

    Sorry - it's hard to explain without looking into the specific flow.

  • mktranslation Profile Picture
    32 on at

    I achieved my aim with a different method, by processing values within Excel and getting them from it. Appreciate your help though.

  • Benny_1857 Profile Picture
    124 on at

    Congratulations!

    Yes, read all file path at same time and copy into excel to use formular or PQ to delimiter is a good solution but hard to explain. IOI

  • Guriga Profile Picture
    188 on at

    First, read the XML from the file into a variable.

    After you parse text with this variable it will give you all the positions of the specific text in the XML.

    Then for each loop to go through the XML to get subtext and save it if you need it. %CurrentItem+30% give you the location of the number so you need to read 3 characters.

    Guriga_5-1643297381198.png

     

    Guriga_4-1643297370883.png

     

     

    Guriga_3-1643297317029.png

    Hope the content above may help you.

    Best Regards

    If my answer helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

     

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 791

#2
Valantis Profile Picture

Valantis 568

#3
Haque Profile Picture

Haque 535

Last 30 days Overall leaderboard