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

Community site session details

Session Id : JXaEAT7oLySCgC5DhqiEvz
Power Automate - Building Flows
Answered

Changing a value (string) to an integer

Like (0) ShareShare
ReportReport
Posted on 10 Jul 2023 13:19:46 by 347

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

I have the same question (0)
  • Femke1 Profile Picture
    347 on 10 Jul 2023 at 14:55:00
    Re: Changing a value (string) to an integer

    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!

  • Verified answer
    Matthy79 Profile Picture
    4,178 Super User 2024 Season 1 on 10 Jul 2023 at 14:34:29
    Re: Changing a value (string) to an integer

    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
    347 on 10 Jul 2023 at 14:26:45
    Re: Changing a value (string) to an integer

    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!

  • Matthy79 Profile Picture
    4,178 Super User 2024 Season 1 on 10 Jul 2023 at 14:03:43
    Re: Changing a value (string) to an integer

    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')

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 798 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 469 Moderator

#3
Power Apps 1919 Profile Picture

Power Apps 1919 333

Last 30 days Overall leaderboard
Loading complete