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

Add array values together - output from MS Forms

Hi all, having a real headache with this.  At first, I was pulling the summed up value down from the spreadsheet generated by MS Forms (I added in a calculation column), but flow keeps spitting out that column as a 0 value on the first run (fine if I rerun it) and it's the same no matter what I do.

 

With no other option, I need to make the flow calculate the value and I'm pretty new to coding.  Everything I'm finding on the subject of adding more than two things seems to draw down from a sharepoint list as a data source, which isn't an option in this case.

 

I've created an array from those MS Form values in the Compose function like so:

 

createArray(
outputs('Get_response_details')?['body/r54d2e838f4704b85869d7be3d84c9817'],
outputs('Get_response_details')?['body/ra492c3687e654148a96bd3c5665b4b5e'],
outputs('Get_response_details')?['body/r365199281e074c39825df8766863d86f'],
outputs('Get_response_details')?['body/r64ab68838da84c1095220deea13e9d30'],
outputs('Get_response_details')?['body/ra5241b87c1784045b3f5c8f61e8562f0'])

 

 

I then put in two two 'initialise variables' as float, then an apply to each stage to loop round the values.

JenLavery_0-1620734693692.png

 

 

The first set variable uses the following:

add(items('Apply_to_each'),variable('finalTotal'))

 

The output message I got was that it would only work with an integer or number, so I inserted another Compose function that put an integer around this output as it didn't like it directly, which should have been my first clue it wouldn't work, it said it couldn't be converted to the target type:

 

int(outputs('Array_for_costs'))

 

 

I'm a bit at a loss here.  How can I sum up my 5 array values?  Any insight would be very much appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

It wasn't an option in this case, as we were using MS Forms rather than the Sharepoint List form.  But I've managed to solve it really inelegantly anyway. 

 

I had to make each individual input an integer, then add together in 4 stages.  Put it in a Scope control for neatness.  😅

View solution in original post

2 REPLIES 2
eliotcole
Power Participant
Power Participant

Have you tried making a SharePoint list for the data, and then running the values from the form directly in to that, and then working from there?

It wasn't an option in this case, as we were using MS Forms rather than the Sharepoint List form.  But I've managed to solve it really inelegantly anyway. 

 

I had to make each individual input an integer, then add together in 4 stages.  Put it in a Scope control for neatness.  😅

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,859)