Post

3 followers Follow
0
Avatar

Nested Functions

Is it possible to build nested functions?  I haven't tried and didn't see anything in the community forum or knowledge base.  If so, will this work with any of the functions or only certain ones?

Matt Bures Answered

Please sign in to leave a comment.

9 comments

0
Avatar

If you are meaning when building custom actions or workflows, then yes you can nest multiple functions, I have done it many times.

Phil Smith 0 votes
Comment actions Permalink
0
Avatar

Phil, would you be able to provide an example? I'm trying to build a nested function into the output message of a Val Rule and "IsNull" expects exactly 1 argument.  I had {If(IsNull($Field1, "Field is Blank", If (IsNull($Field2, "Field2 is Blank, "")}  Thanks in advance!

 

Matt Bures 0 votes
Comment actions Permalink
0
Avatar

Hello Matthew,

I believe that it should be {If(IsNull($Field1), "Field is Blank", If(IsNull($Field2), "Field2 is Blank", ""))} instead.

Please let me know if this works.

Roland Pumputis 0 votes
Comment actions Permalink
0
Avatar

Thanks Roland.  Such a silly mistake that can cause so many headaches.  I didn't catch it in Notepad++ either.

Matt Bures 0 votes
Comment actions Permalink
0
Avatar

Roland, any ideas as to what function I should use to run through a series of statements to check if a field is not blank, if it is blank, to output a message (e.g. - "Update Field 1"), then move to the next statement with similar logic.  I feel like an IF-THEN function would work, but each statement isn't dependent on the predecessor.  

My objective is to not have any output if any of the tested statements are false since I want to use an unordered list for slightly better organization/presentation in the Val Error message.  If it's recommended to not use HTML for this, then I won't.  Thanks!

Matt Bures 0 votes
Comment actions Permalink
0
Avatar

Hello Matthew,

Am I correct to say that you want something like this?

$Field1: non-blank

$Field2: blank

$Field3: non-blank

$Field4: blank

Function output: "Field2 is blank, Field4 is blank"

If so, what is the total number of these fields?

Roland Pumputis 0 votes
Comment actions Permalink
0
Avatar

Roland, yes, that's correct, but can they be in a list so it's more distinguishable?  I've written this, but there has to be a faster and more efficient way to output the blank fields.  The way my message is written below always creates a "bullet" if the output if true.

....

<ul>

<li>{If(IsNull($C_KPIStartDate),"Enter KPI Start Date","")}</li>
<li>{If(IsNull($C_Kick_offDate),"Enter Kick Off Date","")}</li>
<li>{If(IsNull($C_TargetLiveDate),"Enter Current Forecast Go Live Date","")}</li>
<li>{If(IsNull($C_GoLiveDate),"Enter Go Live Date","")}</li>
<li>{If(IsNull($C_TotalServicesRevenueLive),"Use Custom Action to Take Revenue Live","")}</li>
<li>{If(IsNull($C_ClientSurveyContactFirstName),"Enter Client Survey Contact First Name","")}</li>
<li>{If(IsNull($C_ClientSurveyContactLastName),"Enter Client Survey Contact Last Name","")}</li>
<li>{If(IsNull($C_ClientSurveyContactFullName),"Enter Client Survey Contact Full Name","")}</li>
<li>{If(IsNull($C_ClientSurveyContactEmail),"Enter Client Survey Contact Email","")}</li>

</ul>

....

Matt Bures 0 votes
Comment actions Permalink
0
Avatar

Hello Matthew,

I don't think you'll find an easier way than that. However, I would write the above code slightly differently:

<ul>

{If(IsNull($C_KPIStartDate),"<li>Enter KPI Start Date</li>","") + 
If(IsNull($C_Kick_offDate),"<li>Enter Kick Off Date</li>","") +
If(IsNull($C_TargetLiveDate),"<li>Enter Current Forecast Go Live Date</li>","") +
... + 
If(IsNull($C_ClientSurveyContactEmail),"<li>Enter Client Survey Contact Email</li>","")}

</ul>

Please let me know if this works.

Roland Pumputis 0 votes
Comment actions Permalink