How to detect if a variable is empty in Shortcuts

I’m trying to identify photos that are not in albums on my phone. It’s easy to get the “Album” property (although it’s contents are weird) but I want to test if the return value is empty. It seems Shortcuts “If” action doesn’t allow for that. Am i missing something obvious?

Try to set the if to equals and then leave it empty. That has previously worked for me.

Here be dragons and debates about emptiness vs. null.

Just a quick note on checking for empty vs. null, they aren’t the same and don’t always give the results you would expect unless think about it carefully.

Here’s a text based example that uses variables and strings of text as that’s conceptually probably the easiest to deal with. It’s based on trying to match a string where no match can be made.

Take a look at the three tests for “emptiness”. See if you can figure out why not all of the tests seem to work.

I think you are working with strings from it being an identifier property on a photo, but are you looking to identify a blank string or a string that does not exist (null)?


Very late reply: turns out the « album » property for photos is not a simple string. It’s an iterable list of strings that you have to unpack. I ended up transforming it into a dictionary before testing for the presence of data.

I’ve also used counting for 0 items before.