Power Automate Tips: Convert int to string

Power Automate is an amazing tool, but it can take a little time to get used to how it works. One thing that I find annoying is tha if you have variables or data sources which are integers and you want to store/use it elsewhere, as a string, you can’t easily.

Let’s say you initialise a variable as an int, like below:

You want to then use it in a string variable, like the below, you can’t select it within the dynamic content section, it just doesn’t show.

Because the destination is a string, it will only accept strings. To get around this, you have to convert the integer variable to a string. To do this, simply follow the below steps:

1) Select the ‘Value’ field where you want the integer to be used

2) Select ‘Expression’ and click in the textbox

3) Type ‘string()’ without the quotes

4) Make sure the curser is in the middle of the brackets, and select ‘Dynamic content’

5) Select the integer variable / source and you will see it added to the expression

6) Click ‘OK’

7) You will then see it in the ‘Value’ field, as shown below

Now you can do this with other data types too, for example you could convert a date from a string to a datetime field by using the below example:

formatDateTime(utcNow(),'yyyy-MM-dd HH:mm:ss')

There are many more variations, but these are the ones I find myself using the most.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.