Changes

Jump to: navigation, search

SSlogic

140 bytes added, 20:25, 7 August 2020
no edit summary
[[Web Page View Field|Web Page View]] fields can use a unique [[SmartSimple]] logic interpreter. Web page logic gives you the ability to display certain content or perform certain actions only when specified conditions are met.
[[SmartSimple]] logic uses the following syntax:
 
<pre>
<!--@sslogic(CONDITION)-->
* The content to be displayed (the middle line) can either be in plaintext or in HTML.
* Be sure there are quotes (single or double) around the variable and value. Note: Your choice in the use of quotes depends on the variable's contents. E.g. names containing apostrophes should use double quotes when referencing that variable.
* SSlogic does not support nested logic statements. In other words, you cannot put an sslogic statement within another sslogic statement. * NOTE: You can cannot use [[sscalculation]] syntax within an sslogic, so can usually achieve statement. The sslogic syntax will manage the same results in that mannercalculating. It does not require additional syntax prompts.
'''Example:'''
 
* The following will display a Christmas tree image if the month is December:
 
<pre>
<!--@sslogic(month(now())=12)-->
<img src='"images/xmasstree.jpg'" alt="" />
<!--@end-->
</pre>
* Precede the equal sign with an exclamation point to test for '''Not Equal'''
* The following will display a message for all provinces except Ontario:
 
<pre>
<!--@sslogic("@province@"!="Ontario")-->
* Often, you will want to display one of two texts--one text in the case that a condition is met and another in the case that the condition is not met. This is achieved through the use of an "else" operator.
* The following sample code will display one message if a user is male and another if the user is female:
 
<pre>
<!--@sslogic("@sex@"="M")-->
* The following will display 2 check boxes. If the gender is male the first check box (Male) will be ticked. If the gender is female the second check box will be ticked:
 
<pre>
<!--@sslogic('@parent.owner.clientgender@'='Male')-->
<input checked="checked" type="checkbox" checked/> Male <input type="checkbox"/> Female
<!--@else-->
<input type="checkbox"/> Male <input checked="checked" type="checkbox" checked/> Female
<!--@end-->
</pre>
<nowiki><!--@sslogic(</nowiki>''condition 1'')-->aaa
<nowiki><!--@else if(</nowiki>''condition 2'')-->bbb
<nowiki><!--@else if(</nowiki>''condition 3'')-->ccc <nowiki><!--@else-->ddd </nowiki> <nowiki><!--@end--></nowiki></nowiki></nowiki></nowiki>
'''Example:'''
<!--per support ticket 17150 - Else if for sslogic -->
 
==Multiple Conditions==
* You can include more than one condition:
 
<pre>
<!--@sslogic('@year@'='2008' AND ('@month@'='1' OR '@month@'='2'))-->
==Fields Storing Single Quotes==
* SSlogic can be used to display fields that may have a single quote stored within them.
* The escape[] function is used to achieve this:
 
<pre>
<!--@sslogic('escape[$1137762"137762$]'!='')-->
</pre>
==Using Object Lists==
* Object [[Web_Page_View_Field_Variables#List|Lists]] can also be used in SSlogic.
 
<pre>
<!--@sslogic("[#(?object=contact::criteria=rolename='Supervisor'::groupfunction=count)~userid~#]">0)-->
* SSlogic can be used to determine which pdf file is appended to the Web Page View using '''ssattach'''
* The following example will attach ''myfilefooter.pdf'' if the Type/Template is Contract, and ''myotherfilefooter.pdf'' if not:
 
<pre>
<!--@sslogic("@type@"="Contract")-->
<!--@end-->
</pre>
::'''''Note:''' [[ssattach]] can be used without sslogic if you want the same pdf file attached to the Web Page View in all cases.'' 
==Notes==
* SSlogic can be used in workflow e-mails at Level 1 only.
Smartstaff
95
edits

Navigation menu