Tutorial: Adding and subtracting numbers

What is the answer to life, the universe, and everything? Well, 42 of course. In the comedy science fiction series ‘Hitchhikers guide to the galaxy,’ by Douglas Adams, it took the Deep Thought computer seven and a half million years to reach that conclusion.

The task we have on hand is a bit simpler; and we will take seconds, instead of years. Our question: How do we add two numbers (say, 10 and 2) in a Flow app?

We will use the operator element to do this. We can also do more sophisticated calculations with macros and operators, but that is the topic for another tutorial.

We will use two default numbers to do the math here. In real-life scenarios, we will typically get the values from a service, or from the user.

This is what our canvas will look like when we are done:

We will need:

  1. Boomi Flow username/password. (Get a free fully-loaded Boomi Flow account here.)

Let’s get building!

  1. Drag an Operator to the canvas.

    This opens a configuration panel.
  2. Copy-paste Math in the Name field.
  3. Click New Operation. The operations we can do are dynamically updated based on the values we use (For example, we can do mathematical operations with numbers, empty an object value from a Salesforce list value, and so on.)
  4. Click Select or create a new Value.
  5. Click Create a new Value.
  6. Let’s call the value X. The kind of value should be Number.
  7. Copy-paste 10 in the Default Value field.
  8. Click Save.
  9. Select Add as the option for How do you want to change the Value. As we can guess, if we want to try subtraction, we select the Subtract option.
  10. Select Value Of as the option for How do you want to retrieve the reference Value.
  11. Click Select or create a new Value.
  12. Click Create a new Value.
  13. Let’s call this value Y. The kind of value should be Number.
  14. Copy-paste 2 in the Default Value field.
  15. Click Save to save the value.
  16. Click Apply Operation.
  17. Click Save Operator.

    This is what the canvas looks like now:
  18. Create an outcome called Go from Start to Math.

    This is what the canvas looks like now:
  19. Drag a Step element to the canvas. This opens a configuration panel.
  20. Copy-paste Output in the Name field.
  21. Click Insert Value.

    This opens a dialog box that lists all the values in our tenant.
  22. Search for and select the X value we created earlier.

    When we run the flow, this will show us the data stored in the X value at runtime.
  23. Click Save Step.

    This is what the canvas looks like now:
  24. Create an outcome called Go from Math to Output.

That was fast!

And… we are done building. This is what the canvas looks like:

Let’s run the flow now, and see how easily it converts into an app.


Appchievement!

It took us around ten minutes to create an app that can add/subtract two numbers.

The first screen of the app gives us the magic number. 10+2=12!

What if instead of addition, we had chosen subtraction instead?

Hmmm… What is 10-2?


Check out the glossary for a definition of terms and key concepts that appear in the Boomi Flow website, drawing tool, technical documentation, blogs, and marketing communications.

If you need to take a closer look, click on the images to enlarge them. Have a question? Click the Help button on the bottom right-hand corner of this page to ask.