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
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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,909)