And to make it EVEN WORSE, testing empty strings isn't that straightforward because sometimes users will start typing something into a field, change their minds, delete their input, and unknowingly leave behind a rogue SPACE character. The "empty input test" above would fail to catch a field containing nothing but a space character. Now I have to change field == "" into this: field.trim() == "".
That itself isn't a big deal UNTIL you try to use that same test for deluge variables. Let's say you call a function within your workflow and the function returns a null value. NOW when you try to see if the function returned an empty value, you can't use the .trim() function because you cannot trim a null value. The code breaks.
So when testing for empty values in Zoho Creator, you have to consider (A) where you are implementing the condition, (B) what type of field you are testing, (C) what type of value you consider to be "empty", (D) whether you are testing for a form field value or a deluge variable value. It's an inconsistent nightmare that results in so many errors and workflow failures.
PROPOSED SOLUTION
Wouldn't it be great if there was a catch-all function for testing if something is empty??? For example:
- if ( anyType_ofFieldorValue.isCompletelyFreakingEmpty() )
- {
- // I would be a much happier deluge coder
- }
I though the function "isValidObject()" would do the job, but it doesn't. It also produces inconsistent/unreliable results.
Thank you for coming to my TedTalk. Good day.