0

I am using a calculated number in a SharePoint list and using this value in an email using a Power Automate Flow. The value should come as 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, For example, if the value is 3, then it comes as 3.00000000000000.

How can I format this to an integer from decimal in Flow?

I tried the below expression to format this,

formatNumber(int(outputs('When_an_item_is_created')?['body/TotalDays']), '0,0', 'en-us')

Where my flow is triggering with SharePoint action is 'When an item is created' and SharePoint calculated column is 'TotalDays'.

Here is the screenshot of Flow for reference

After applying this formula I got an error like:

"Correct to include a valid reference to 'When_an_item_is_created' for the input parameter(s) of action 'Send_an_email_to_user_for_successfully_submitted'."

1
  • Are you using correct reference to "TotalDays" column in function expression? Check my answer given here. let me know if it works for you. Oct 12, 2021 at 11:43

1 Answer 1

0

Please use the below expression:

div(sub(ticks(triggerOutputs()?['body/EndDate']),ticks(triggerOutputs()?['body/StartDate'])),864000000000)

In my test:

My Flow:

enter image description here

My list:

enter image description here

Email:

enter image description here

Note:

  • Use the Ticks function to compare dates with each other. For example calculating the number of days between two dates, you should convert the dates to Ticks first, subtract these from eachother and convert the result to the number of days back again.
  • Ticks are the 100 nanoseconds interval ticks since 1 Jan 1601. Each day has 864000000000 ticks.

Reference:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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