How do you test for a null message or symbol?
Sep 18 2016 | 5:09 am
I am importing data that I don't create, and I need to be able to test if a message or symbol is null.
I am basically importing json data using dict - and when querying the value of one of the keys I want to check if the key contains a null string : ""
Am I missing something simple? I have searched for a while now, and can't seem to find any ideas. How do I do this?
- Sep 18 2016 | 7:29 amTurns out it seems there is a secret... if you use a [route ""] object, route will bang on empty message. It seems you actually have to enter the double quotes as the parameter to route in order for this to work. You can't just use [route]. Here is a sample patch.
- Sep 18 2016 | 7:46 amUhgg... I don't think its working. It seems like whenever I save the patch and then reload it the [route ""] object gets changed into a [route] object and it stops working.So now I am stuck again... There has got to be a way to test for an empty (null) message, right?
- Sep 18 2016 | 9:07 amhmm. maybe...
- Sep 18 2016 | 9:59 amOh yeah.. in terms of your ultimate goal..
- Sep 18 2016 | 10:33 amYeah, I figured out that there is no way to clear the data in an fpic once it has been set, and you have to use "hidden 1" and "hidden 0". I really think that fpic should have a "clear" message that it responds to which basically resets it to its initial state.I am also learning that fpic leaves a lot to be desired - especially in regards to image cropping and justification. But, I am sure the C74 feature request list is monstrous as is.
- Sep 18 2016 | 11:38 amWow indeed, metamax's solution is far more elegant, I am almost jealous! As for the "null" checking, I do understand the need for it across the environment, but I also think that Max's graphical environment diverges from the "coding" mentality. As I understand, it is meant a bit to "just work"! Make an object, "bang" goes in, result goes out, "cable" here, "cable" there, simple!! You don't need to know what a "null" variable is. But there is a need for lower level coding, and is (somewhat) covered in the JS and Gen environments, where you are excepted to know your stuff! Anyway, I am probably getting carried away over a "null" comparison! Good luck with the project!Nick
- May 10 2020 | 7:56 pm[select "<empty>"] is working for me. Cheers.
- Feb 23 2022 | 4:27 pm
[select "<empty>"] is working for me.I guess you mean typing [select ""] when instanciating the object. It works until you save your patch, close it and re-open it. Then it doesn't work anymore, because the empty string arguments got discarded and the corresponding inlets and outlets disappeared. FWIW, I found this trick for use with [select] and [route] :