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

Replace/ Remove Blank value in Body/ Item - Transform Input from Array to integer to Single Number

Hi everyone.

 

I'm currently developing a Flow in which the numbers are extracted from SharePoint list (from Get Item).

However, there is a blank (aka Null) in the value section (after Select)

 

My objective is calculating the sum of numbers (via XPath method/ addition of integers in the body)

 

WithBlank

straight1_0-1667448603211.png

 

NoBlank

straight1_1-1667448623843.png

 

Add

straight1_2-1667448651024.png

 

Flow

straight1_3-1667448694999.png

 

What are the suggested actions and expressions, from WithBlank to NoBlank to Add?

 

I realise the input collected earlier steps are in array/ string type, so maybe need to change it to integer in WithBlank step

 

If possible, how about replace the "" (blank)/ null in WithBlank to 0? What is the action/ expression?

 

Most of the use cases I found online are on Power BI/ Power App, so your assistance is truly appreciated.

 

Thank you

1 REPLY 1
grantjenkins
Community Champion
Community Champion

This should be what you are after. Note I've stated with the list of numbers as strings.

 

grantjenkins_0-1667449938576.png

 

Compose is your array of numbers (strings).

grantjenkins_1-1667449982682.png

 

Filter array can be used to remove empty strings as so. Note the expression is just item()

grantjenkins_2-1667450017770.png

 

JSON converts the output to XML.

grantjenkins_3-1667450054709.png

 

And finally, your xpath to sum up the numbers.

xpath(xml(outputs('JSON')), 'sum(/root/Numbers)')

grantjenkins_4-1667450078327.png

 

Result is:

grantjenkins_5-1667450163640.png

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (2,037)