•Use Processor for Math Calculations
We want to check if there are enough units in stock. We know the total unitsInStock
and unitsOnOrder
so in order to find the available count we should subtract unitsOnOrder
from unitsInStock
. For that purpose, we'll use a processor. Processors are very powerful and provide great extensibility, but for this simple example we'll use the built-in function Subtract
.
- Drag & Drop the Processor node to the canvas.
- Double click to open the configuration.
- Change the default name, e.g. CalculateAvailability
- Select the drop down menu and start typing 'Subtract', choose the option when it becomes visible
- For
x
parameter, click on a Use variable from state button and then select the fieldGetProduct.unitsInStock
- For
y
parameter, click on a Use variable from state button and then select the fieldGetProduct.unitsOnOrder
- Select Apply button
- Save the workflow
•Next Steps
Add conditions with the Rule node