Do you want to create an empty string variable? Do you want to append a new line that’s blank? Well you may have tried to do this on Power Automate Desktop, however, you’ve hit the ‘Parameter ‘To’: Can’t be empty‘ error issue, this blog post will show you what you need to do to work around this correctly.
What does this solve?
The error you may be running into is the ‘Parameter ‘To’: Can’t be empty‘. I’ve hit this error multiple times when trying to compare something to an empty string, creating an empty string variable or simply trying to append a blank new line to an existing string. This will solve these error messages.
How to solve the error(s)
We’re going to look at all three scenarios (String Variable Creation, Empty String Comparison & Blank New Line). There’s a video showing you every step or if you prefer there is a text based guide below:
Firstly, we are going to look at the String Variable issue.
Empty String Variable
Lets create a variable and try to save with nothing in the ‘To’ section. You will now see an error ‘Can’t be empty‘.
This is due to the variables in Power Automate Desktop not using a strongly typed approach. What does strongly typed mean? It means that you’re not defining that this is a string, int, float etc. Therefore, if you leave the ‘To’ section empty, Power Automate Desktop does not know what type of variable this will be.
Let’s try to enter an empty string using “” and saving. You will notice that the variable is now a string variable, however, you now have a string variable of “”, it’s not an empty string, it’s a string that contains quotation marks.
To solve this issue, we can use:
The %””% is an already present empty string variable that is provided by Power Automate Desktop, to define that the entry for the string variable is in-fact an empty string and not quotation marks. Lets try that now.
The result is shown below. It’s a string variable that’s empty!
Empty String Comparison
We already have an empty string variable from our previous section that we will be using as an example on data provided to us in this demonstration. We want to check if the empty string provided is actually empty, lets create an if statement and try to save with nothing in the ‘Second Operand’ section. You see an error ‘Can’t be empty‘.
As you can see, we’re getting the same error, lets try using quotation (“”) marks to signify an empty string.
The if statement never works as, if you look closely, it thinks we’re looking for quotation marks by wrapping our provided quotation marks in additional quotation marks as ‘“”‘. We can resolve this by using the %””% in the ‘Second Operand’ to signify we’re comparing to an empty string.
Now, if we run the demonstration, we can see that we correctly go into the if statement as we’re comparing to an empty string:
Append an Empty Line
If you’re entering data on a website and you simply want to append an empty line between data, you can easily do this with the same method that has been used in our previous examples (%””%).
Lets create a variable with a string of ‘FlowJoe’:
Lets now append a new line to our string using the set variable action again. We can pass in the same variable we just created, setting the variable name the same and pressing return to add a new line.
This essentially will (should) add the current variable to the input, add a new line and then replace the old variable with the new line. However, when looking at the data after it is run, Power Automate Desktop does not recognize the empty line.
As you can see from the example above we only have one line still, we can add “” on the empty line but that will just add quotation marks on the second line, not an empty string.
Therefore, if we use the same approach as previously used and add %””% to the new line, we will get an empty line after FlowJoe.
You can see above that the empty line has now been added, this is great for separating data within a string, especially when you’re entering a lot of data into a text field on a website, and you want to simply append all of the information, you can stylize the string beforehand and just pass all of the information in one go.