Red Green Repeat Adventures of a Spec Driven Junkie

Shortcut - Getting Numeric Input

I made Shortcuts on my Apple iPhone to help me record activities. One of the things that help me make entries easier on an iPhone is getting numeric inputs on a Shortcut.

This is the first in a series:

Introduction

In the previous article, it discussed displaying a result using the Show Alert shortcut.

This time, we will setup a numeric input and connect it to the alert to display the input.

Get Numeric Input

Start with a clean Shortcuts project and use Add Action to add the “Get Numbers from Input”

Shortcut - Add Action

Add Action and search for “Get Numeric Input”: Shortcut - Search Get Numbers

This is how the Shortcut project will look with the Get Numeric Input: Shortcut - Input Numbers

Test out the action by pressing the ▶️ button and enter a value, say 42, this is what the test will look like:

Shortcut - Numbers Test

After testing out, the Shortcut screen will have a new section displaying the input.

Shortcut - Numbers Result

Add Show Alert

Let’s add the Show Alert to this Shortcut by using the “Search for apps and actions” on the bottom of the screen.

Selecting Show Alert will add it to the Shortcut:

Shortcut - Add Alert

Test out the Shortcut now by pressing the ▶️ button - you will enter a value like before, and an alert will pop up:

Shortcut - Test Alert

Connect Input and Show Alert

To have Show Alert display the value from the numeric input, tap on the “Do you want to continue?” blue text on Show Alert. A keyboard input will pop up with “Select Variable” options:

Shortcut - Connect Numbers and Alert

Tap on “Numbers” and tap “Done”. There should be a vertical line connecting the two sections now. Before, there was no lines connecting them.

Test out the Shortcut now by pressing the ▶️ button - enter a value like before, and an alert will pop up with the value in the alert!

Shortcut - Test Numbers and Alert

Conclusion

Connecting Shortcut’s numeric input with show alert enables basic numeric input and validating Shortcut receives user result.