1

I am using a calculated column (number) in a SharePoint list, and putting the value into an email using a Power Automate Flow. The value will always be an integer.

When the value is passed through to Flow, it's converted to a string with a decimal point and 14 zero's added, so 7 becomes 7.00000000000000.

How can I format this to be an integer with no trailing decimal in Flow?

4
  • 1
    How many decimal places you have set to your calculated column from settings? Oct 24, 2020 at 11:13
  • @GaneshSanap It's set to no decimal places.
    – Arronical
    Oct 24, 2020 at 13:31
  • 1
    Ok, Try my solution given below. let me know if it works for you or if you come across any issue. Oct 24, 2020 at 13:43
  • I have the same problem, after applying this method and I am getting an error. > "InvalidTemplate. Unable to process template language expressions in > action 'Send_an_email_(V2)' inputs at line '1' and column '14597': > 'The template language function 'int' was invoked with a parameter > that is not valid. The value cannot be converted to the target > type.'." Do you have an idea what can be the reason? P.S. In SharePoint, I selected Number for data output.
    – GIS GIS
    May 13, 2021 at 12:03

1 Answer 1

2

Use below formula:

formatNumber(int(outputs('<Get SharePoint Data Action Name>')?['body/<calculated column name>']), '0,0.00', 'en-us')

This will convert your calculated column to #,#.00 format (with 2 decimal points).

If you want the number without decimal points then you can use below formula:

formatNumber(int(outputs('<Get SharePoint Data Action Name>')?['body/<calculated column name>']), '0,0', 'en-us')

Replace Get SharePoint Data Action Name and calculated column name with your action name and calculate column name respectively.

You can convert the string to number in Microsoft flow using int function.

And You can format the number to desired format in Microsoft flow using formatNumber function.

Flow:

enter image description here

Output:

enter image description here

7
  • Thanks, I'm struggling to pass through the column value to the function. I'm using the 'When an item or file is modified' trigger, which can return an array of items (it will only ever return one in my case). Would you mind taking a look if I add a screenshot to my question?
    – Arronical
    Oct 24, 2020 at 14:18
  • Sure, what is the name of your calculated column? Also, where are you using calculated column value? I am not able to see email body (if you are showing number value in body) in screenshot attached. Oct 24, 2020 at 14:24
  • The column name is 'SLA', thanks for your help!
    – Arronical
    Oct 24, 2020 at 14:27
  • Also, why are you using "Apply to each" action when you are getting only one item? Oct 24, 2020 at 14:28
  • 1
    I managed to use a the 'When an item is created or modified' trigger, and add a condition to only proceed when the item is modified. Your answer was perfect for the original question, so I've edited back to that. Thanks again!
    – Arronical
    Oct 24, 2020 at 15:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.