web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Convert text to number
Power Automate
Answered

Convert text to number

(4) ShareShare
ReportReport
Posted on by 29

Greetings:

 

I am using an MS Forms form to trigger an MS Flow which will transfer the input into a new list item in sharepoint.  Even though MS Forms allows you to specify that a field has to be a number, it seems to pass to flow as a text.  Is there a way to convert the text into a number in a number field? 

 

Thank you

 

John

Categories:
I have the same question (0)
  • Verified answer
    v-micsh-msft Profile Picture
    on at

    Hi @Glebenerd,

     

    Yes, there is a way to convert it into Number in Microsoft Flow.

    An easy way for you to manage,

    1. Add one compose Action, choose the field (Dynamic content from the form actions) that you would like to convert as the Compose Input, 

    2. Add another Compose Action, under the Input, copy and paste the following:

    "@int(outputs('Compose'))"      //for integer

    Or

    "@float(outputs('Compose'))"   // for floating-point number

    Function reference: WorkFlow Definition Language.

    3. Then use the Dynamic outputs of Compose 2 for the atcual field.

     

    Regards,

    Michael

  • Glebenerd Profile Picture
    29 on at

    Thank you:

     

    That answer opened up a world possibilities,  I had no idea that compose allowed you to reach into the workflow language.

     

    John

  • hassaanahmad Profile Picture
    21 on at

    Michael,

    Thanks for your solution. Unfortunately, I wasn't able to get the Flow to work for me. With the two (2) compose functions, I attemped to convert my 'Total Cost' value from a string to an integer per your instructions. However, when I use the dynamic output of Compose 2 (i.e., this is  the compose titled 'Total Cost' for me) in a 'greater than or equal to' function, I get an error. See the screenshots below. I'd greatly appreciate your help. Thank you.

    1.png

     

     

     

    2.png

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  • hassaanahmad Profile Picture
    21 on at

    I figured it out. I used the 'float' conversion function: 

    float(triggerBody()?['Total_x0020_Cost'])
     
    Thanks anyway.
  • LMeister Profile Picture
    4 on at
    Another possible way to convert string to int:

    first initialize a empty string variable at the start of the flow using the intialize variable, in my case i named it 'deletionID'.

    Then add in the text you want using the set variable function down in the flow

    Then you can use the compose with the input as "@int(variables('deletionID'))". The output from the compose will be an int value.

    What variables does is that it takes in the name of any variable and gives you the value of the variable. Int function will only take in a value so the output of variables sits nicely in the formula

    Just wanted to share this as an alternative if error occurs when there are multiple compose needed in parallel branch
  • ilu989 Profile Picture
    164 on at

    Hi @v-micsh-msft ,

     

    Can you please tell me how to convert the integer to be the string? Ex: 123 converts to "123"

    Because I just use the "Select" action to make my data like this:

    string capture.JPG

    But I need to use "0" to be the unique key for filter array, but filter array can't recognize the integer content, so I need to convert to be the string, how can I get this? I already try String(item()[0]) in Select action, but not workable.

     

    Please give me any advice.

    Regards,

    ilu989

  • Community Power Platform Member Profile Picture
    on at

    Hi Mates,

     

    Just remove here double quotes means just use like below its working charming

    @int(outputs('Compose'))

    Thanks

  • Community Power Platform Member Profile Picture
    on at

    I know it's a few years late, but thanks for this! For some reason other expressions were not working for me, but float did the trick. 

  • bogdanf Profile Picture
    16 on at

    Hello, 

     

    In your question - float(triggerBody()?['Total_x0020_Cost']) - what is the purpose of "?" ?

  • Guy Boswell Profile Picture
    234 on at

    Why, oh why, oh why is this a thing?!?!?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 237 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 176 Super User 2026 Season 1

#3
Power Platform 1919 Profile Picture

Power Platform 1919 96 Super User 2026 Season 1

Last 30 days Overall leaderboard