This Power Automate tutorial explains how to initialize integer variable in Power Automate with an example.
Initialize Integer Variable in Power Automate
- One of the variable datatypes in Power Automate flow is an Integer data type. When we initialize a variable with an integer variable type, it accepts the Whole number value that can be positive, negative, or zero.
- When we initialize a variable with integer type, it accepts only the Single Parameter in the value section. It will not accept multiple values.
In the following example, we will see how to initialize a variable Integer in Power Automate flow.
Let us see how we can initialize a variable Integer in the Power Automate flow.
In this example, we will use two integer values as input values to calculate the previous month and current month sales values, and add then we will initialize a variable to add the previous month’s and current month’s sales values.
Create an instant cloud flow, select the trigger as manually trigger a flow, and click on the create option.
- Expand the Manually trigger flow, and choose the type of user input by selecting +Add an input and select the Number variable type.
- Now add the +new step, select the initialized variable to enter the variable name, choose the variable type as Integer, and in the value section, pass the dynamic value.
- In this example, I have added a Current Month’s sales value. In the same way, initialize another variable to get the Previous Month’s Salesvalue as below:
Now, we will add the compose action, to add the two sale values using the add function from the initialized variable to get output.
- add -> Function name
- VarInt1,VarInt2 -> Initialized Variables names
- Save and Test the Power Automate flow and then Run the flow automatically.
- In the screenshot below, in the compose action, you can see it displays the addition of the current month sales value and the previous month’s sales value, as highlighted below:
This is how to initialize the variable Integer in Power Automate flow.
In the same way, in this example, we will subtract the initialized variable’s values with the type of Integer in Power Automate flow.
- Select the created Power Automate instant cloud flow, expand the trigger action, select Add an input ->, and then choose the input type as a Number.
- Enter the Name and pass the numeric value in the value section as highlighted below:
- Now add the +new step and select the initialize variable, then enter the variable name and choose the variable type as Integer. In the value section, pass the dynamic value for the Generator age.
- Similarly, add the dynamic value for the Generator Warranty Period with the variable type as an Integer.
- Select the compose action to calculate the remaining generator warranty period in years, enter the below expression click update or ok option.
sub(variables('Generator Warranty Period'),variables('Generator Age'))
- sub -> Function name
- Generator Warranty Period,Generator Age -> Initialized Variables names
- In the below screenshot, we can see that the compose action displays the remaining generator warranty period as below:
This is another example of initializing an integer variable in Power Automate flow.
In this Power Automate Tutorial, I have explained how to initialize an integer variable in Power Automate.
You may like the following Power Automate tutorials:
- Initialize Object Variable in Power Automate
- Initialize Float Variable in Power Automate
- How to Initialize A Variable in Power Automate?
- Initialize Boolean Variable in Power Automate
Bijay Kumar Sahoo is a highly accomplished professional with over 15 years of experience in the field of SharePoint and related technologies. He has been recognized as a Microsoft MVP (Most Valuable Professional) more than 9 times, starting from April 2014, for his exceptional contributions to the SharePoint community. Bijay is also a prolific author, having written two books on SharePoint – “Microsoft Power Platform – A Deep Dive” and “SharePoint Online Modern Experience Practical Guide“. His deep insights into SharePoint are also shared on his popular YouTube channel EnjoySharePoint where he teaches SharePoint to a global audience (From various countries like the United States of America, Canada, the United Kingdom, Australia, New Zealand, etc). Read more…