Getting value from a dictionary in Data Jar

My co-founder challenged me to build something really cool using Siri Shortcuts.

I’m building a Shortcut where I can tell Siri “toothpaste and toilet paper”, it then splits the text based on “and”, and then checks if Data Jar has the ASIN value stored under that name.

I’m having success on the input and text manipulation but cannot seem to have Shortcuts check if that value exists in Data Jar and then return the stored value.

Here is what the shortcut currently looks like:

Here is the Data Jar side of things:

Here’s a link to the actual Shortcut - https://www.icloud.com/shortcuts/9815534a7e9b49d9958904a4233ee853

I’m sure it’s something very simple being overlooked :thinking:

Any ideas?

You can simply query Data Jar with it’s Get Value action. It supports a replacement value if it can’t find the requested key:

If you want to handle the case separately when the key doesn’t exist, then you can either check if the action returned anything or you can use the Check If Value Exists action:

Edit:
Sorry, I didn’t see that these keys are stored in a dictionary in Data Jar. In that case, just retrieve the whole dictionary and use the Get Dictionary Value action to get all keys before the loop. In the loop check if the key list includes your key and if it does use the Get Dictionary Value action again to retrieve its value.

Here is an example shortcut: https://www.icloud.com/shortcuts/087c5eac1bd34e88bb5fa0225225197f

1 Like