IF Expression building, EmptyString and missing Is Blank


Badge +1

Sorry if this is addressed elsewhere, but i am relatively new to Appit (I'm guessing most are :-D), but there seems to be a disconnect between the documentation and reality at least with regards some of the expression building functions.

 

Case in point; the Is Blank is documented as a function that should return true if a string is empty.  This would seem to be ideal for the 'IF' function that seems to ONLY accept functions that are strictly defined as logical functions to start.  The 'EmptyString() function does not appear to be allowed by IF even though you would think it IS a logical function as well.  Since the alternative Is Blank appears to be gone, I am at a loss what to do here.

 

All I really need, is a simple way to test for the presence of text in a field so when a WF is creating an email it presents that text or a default string stored in the WF.

 

The IF construct seems a little convoluted to start, and add to this that it wont allow for emptystring() to even be added for evaluation to True/False, not sure what else I can do.  Has anyone else gotten around this?

 

Thanks!


4 replies

Userlevel 3
Badge +10

I assume the confusion is that the 'Is Blank' function is only found in Expressions for forms and views in K2 Designer, not the Inline Functions of the Workflow editor (see this documentation).  There are a few ways you could do it:


 



  • Create a data field with a default value, so if nothing gets passed into it it assumes the default. 
  • If you're worried about 'empty' data being passed in, you could Trim() the data and then check for length > 1, or use a regular expression to validate against whitespace, and nest that all in an IF statement with an 'else' condition that uses your default value.
  • If this data is coming from a form to the workflow, you could use the expressions there and contain all the logic at the form level before passing it along.
Badge +1

Thanks for the info.  The reason it is not contained within the form is because the process requirements allow for the user to bypass the form (so it is entirely possible for the field to be empty, but undesirable to have a default value there if the form is loaded.  (Example) An offer process is accepted or declined. If accepted, no reason is needed (and no default value desire either).  If declined, a reason may or may not be given, but an email is sent.  If a reason is provided in the field, it is place in the email, otherwise a default string of 'no reason provided' is desired. 

 

It seemed like a simple feat, but the IF expression seems hell bent on ONLY allowing boolean functions (IOW, already tried length > 1 after Trim().  The expression field turns red and wont allow it, even if the end result evaluates to True/False.

 

Am I missing something here?

Userlevel 3
Badge +10

Thanks for the clarification.  You will need to nest all this in specific order. 


 


Drag an IF statement into the field where you want the output string, and for the condition of the IF, drag in an Inline Functions -> Expression object. 


 


16911iDBB93ACE88C1740A.png


 


In the expression editor, drag in your data field, click '=' then drag in the EmptyString() function. 


 


15257iB60F01877405FEE3.png


 


Click okay, then set your true or false output string.


 


15993i9D8DF1003FA406E6.png


 


This should get around the condition field issue.


 


- Jonathan

Badge +1

Thanks, the expression object was the missing part of the equation.

 

Much appreciated!

Reply