When you get a bit more acquainted with shortcuts you may begin to wonder how to do certain things.
One of those things could be how to store and retrieve values between shortcuts, in this article we will talk about two different methods.
The first one is the simple method, with the use of a free app called DataJar, the second method is the native way by storing a JSON File in iCloud drive.
App Highlight | DataJar Data Jar is a data store designed to be used with Shortcuts. The data store lets you persist key-value pairs. If you have used dictionaries and lists in Shortcuts, then you'll find that the data format used by Data Jar is very similar. Download here
Developed by Simon B. Støvring this app has shortcuts support and allows you to store and retrieve as many values you want.
We are gonna talk about how this would work for your shortcuts.
If we look at which actions are available for this app it can be a but of overwhelming, however we only need two actions to make this work.
Get value and Set value
So let’s say in this example we have a value in Shortcut 1 that we want to use in Shortcut 2. We are using a text box to demonstrate but this can be any magic variable.
After we run this shortcut and check in the app DataJar we will see the value we just stored.
Now if we want to retrieve this value in another shortcut all we need is the Get value action.
The value retrieved can be used in the other shortcut now. Please note that you can rewrite to the same key as many times you want.
The native way
But what if we create shortcut to share with other users? how do we store and retrieve values from iCloud drive ?
In this example we use the same text block but you can store any magic variable into iCloud drive.
And then we need to retrieve that value in a different shortcut.
That is all there is to it, if we have any questions don’t hesitate to leave a comment.
Also follow my socials to stay up to date on new articles and tutorials.