cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
milind
Frequent Visitor

Setting string variable to empty

I want to set string variable to empty.  I am initializing string viriable empty then I am appending that variable in loop but before appending loop each time I want to make it empty.

 

Is there any way to do that

 

1.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

Hey @milind 

 

You can use the expression editor to set the value as null and it will empty that variable: 

ddew.PNG

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

8 REPLIES 8
yashag2255
Dual Super User II
Dual Super User II

Hey @milind 

 

You can use the expression editor to set the value as null and it will empty that variable: 

ddew.PNG

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

thats wonderful solution 🙂 

This approach suddenly stopped working for me about a week ago... has the syntax of the null functoin changed?

Hey @Matt_Markahm 

 

I have made another test on my side and it is working as expected. Are you facing any errors or issues? Can you share a screenshot of that? 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

@yashag2255 @

I am using a string variable to capture a set of values stored in a SharePoint multi-select list, put them together into a text field and then print that field to a MS Word template for a report.

 

I initialize the variable:

Initializing the String VariableInitializing the String Variable

Then I use a loop to append values to the string:

Append Text to String.PNG

 

Once the value of the string variable has been written to an instance of the report, I am trying to clear it using the method previously described:

Null the String Variable.PNG

 

This approach was working, but lately it has been failing as you can see in this example of the results from one of the generated Word files:

Output of Variable.PNG

 

There should be no repeats in this list if the string variable is being set to null between each iteration of the loop... instead it seems that the list just grows and grows as each record's list is appended to the variable. Any suggestions would be greatly appreciated.

 

Thanks!

Matt

 

Hey @Matt_Markahm 

 

Is null string a variable that you created? 

 

If you observe the screenshot that I have shared, you will see that i just used null. You can do that by placing the cursor in the value and then in the expression editor, type null and choose from the filtered list. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

mleehersh
Regular Visitor

Has anyone found a new way to do this?  Using null() in the expression builder for the Set Variable step is no longer allowed, it says invalid and won't let me save it.  I need to find a way to actually clear it out.

Rick97213
New Member

I'm new to Power Automate under Windows 10 21H1 (free version). The only way I discovered to clear a string variable is to use the Clear List command. It seems to treat it as a list of characters and create a truly empty string that works with the 'is empty' IF statement.

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (44,176)