Ninox Profile

I have two datasets - Leaders and Media - in a 1: n relationship.

I'd like a f(x) field in Leaders to check the Media files linked to a Leader file and return a value (Available / Unavailable) based on the values of choice fields in those linked Media files. 

So, for example:

If any of the linked Media files fulfils certain conditions (returns "Magazine" in the choice field Output, does not return "Used" in the field State, and the image field PIC 1 is not empty) then the value is Available, otherwise Unavailable.

I know this should be basically an IF/ELSE formula, but can someone confirm it's the best way to do this and give me some script to start from?