cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kensley
Resolver I
Resolver I

How to append integer variable to another integer variable with Power Automate?

If I initialize an integer variable before my custom actions are set, and set its default value to 0, 

then later in my loop set a condition to check if a Microsoft form integer variable is not null, 

Then how can I assign this Microsoft form integer variable to my original initialized variable?

 

What's the most primitive way of handling this?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Mira_Ghaly
Dual Super User II
Dual Super User II

@kensley 

you can use compose data operation and use the add expression add(yourVariable,valueinsideyourloop)

then update your variable to the output of the compose data operation

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

View solution in original post

4 REPLIES 4
Mira_Ghaly
Dual Super User II
Dual Super User II

@kensley 

you can use compose data operation and use the add expression add(yourVariable,valueinsideyourloop)

then update your variable to the output of the compose data operation

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

View solution in original post

kensley
Resolver I
Resolver I

That is so awesome!  Just one tiny thing if you can update your answer, how can I confirm that the second variable (The one inside my loop) should be "treated" as an integer.  Meaning if the variable came back empty, I want it to be treated as 0 integer.  Is this an easy tweak to apply?

 

Based on your excellent help, this is working for me so far...

 

 

 

 

add(variables('Cook Time (Minutes)'),outputs('Get_response_details')?['body/r5ac288b2b44845ccbaa6489d9b2da63e'])

 

 

 

 

 ...I just want to guarantee that second variable gets treated as an int (if its blank turn it to 0).

Mira_Ghaly
Dual Super User II
Dual Super User II

@kensley 

can you try the below:

add(variables('Cook Time (Minutes)'),if(equals(outputs('Get_response_details')?['body/r5ac288b2b44845ccbaa6489d9b2da63e'],null),0,outputs('Get_response_details')?['body/r5ac288b2b44845ccbaa6489d9b2da63e']))


 

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here
kensley
Resolver I
Resolver I

That helped me out!  All I had to do was change the null to ''

 

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!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,320)