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 / Changing a value (stri...
Power Automate
Answered

Changing a value (string) to an integer

(0) ShareShare
ReportReport
Posted on by 348

Hi all,

 

I've read multiple articles on this one, but I cannot get it right.

 

In Lists I have a calculated column (when I put in the number 10 in a different column, it is multiplied by 28). Although I've set the outcome to number, apparently in Power Automate it still turns out as a string. When I use the value in a 'Populate a Word document' - it gives me back the calculated number (280 in this case), but it adds 12 zeros after the decimal point (280.000000000000).

 

I just want the number 280 (or another calculated number) in the Word document 😉

 

I've put in an action Format Number, but that gives me the error: 'The template language function 'formatNumber' expects its first parameter to be an integer or a decimal number. The provided value is of type 'String'.

 

So I tried something with Initialize variables and Compose (expression int(items('Apply_to_each')['ColumnName'])) - but I don't have an apply to each there.  Tried to insert an apply to each, adjust the expression, I'm lost now....

 

Hope you can help, thanks a lot in advance 🙂

 

50.png

Categories:
I have the same question (0)
  • Matthy79 Profile Picture
    4,188 Super User 2024 Season 1 on at

    Hello @Femke1 

     

    You don't need a new variable. In the expression where you get the error "The template language function 'formatNumber' expects its first parameter to be an integer or a decimal number" just add another expression. For example if it looks like this:

     

    formatNumber(yourStringNumber, '0')

     

    change it to:

     

    formatNumber(int(yourStringNumber), '0')

  • Femke1 Profile Picture
    348 on at

    Hi Matthy79,

     

    Thanks for your suggestion! Much appreciated 🙏

     

    Don't know if I understand you correctly, but what I've tried, gives me the same error:

     

    Femke1_0-1688999014390.png

     

    I used the expression:

    formatNumber(int(outputs('Create_item_-_NAME-OF-THE-ACTION-ABOVE')?['body/NAME-OF-THE-COLUMN']), '0')

     

    Do you have a suggestion of what I'm missing?

     

    Thanks a lot!

  • Verified answer
    Matthy79 Profile Picture
    4,188 Super User 2024 Season 1 on at

    Hello @Femke1 

     

    You didn't use the expression but an action to format a number. This way it works a little different. Into the first field you have to put a valid number. In your case it would be "int(outputs('Create_item_-_NAME-OF-THE-ACTION-ABOVE')?['body/NAME-OF-THE-COLUMN'])". So without the formatNumber around.

     

    After that action works fine you can use dynamic content to work with it later.

     

    The expression you posted can be used directly inside another action ("Populate a word template" for example).

  • Femke1 Profile Picture
    348 on at

    Thank you so much @Matthy79! I deleted the 'Format number' action and put in the expression directly in 'Populate a Word document' and now it works beautifully 😇

     

    Thanks again for your quick help!

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard