Differences

This shows you the differences between two versions of the page.

Link to this comparison view

user_defined_functions [2016/09/22 02:36]
127.0.0.1 external edit
user_defined_functions [2017/12/24 01:58] (current)
admin
Line 12: Line 12:
  
 You can create as many user defined functions as you want. Each user defined function is declared with //func// tag that has a //name// attribute . You can create as many user defined functions as you want. Each user defined function is declared with //func// tag that has a //name// attribute .
-   <func name="​func1">​+  ​<func name="​func1">​
       <log msg="​inside func1: parameters are $listParam()"/>​       <log msg="​inside func1: parameters are $listParam()"/>​
       <action code="​$setFuncReturn('​return value'​)"/>​       <action code="​$setFuncReturn('​return value'​)"/>​
-   </​func>​+  ​</​func>​
        
 User defined function can take 0 or any number of parameters. Parameters are specified as key=value pairs. Multiple parameters are passed in separately, e.g. User defined function can take 0 or any number of parameters. Parameters are specified as key=value pairs. Multiple parameters are passed in separately, e.g.
  
-    ​$callFunc('​func1','​lastName=smith','​firstName=john'​)+  ​$callFunc('​func1','​lastName=smith','​firstName=john'​)
  
 Within the //func// tag, you add any mscript tags and methods. You can access the parameters passed into the function with mscript method //​$getFuncParam('​lastName'​)//​. Within the //func// tag, you add any mscript tags and methods. You can access the parameters passed into the function with mscript method //​$getFuncParam('​lastName'​)//​.
Line 29: Line 29:
 Below is an example of a user defined function that returns a full name: Below is an example of a user defined function that returns a full name:
  
-     <func name='​getFullName'>​ +  ​<func name='​getFullName'>​ 
-        <action code="​$setFuncReturn('​$getFuncParam('​lastName'​),​ $getFuncParam('​firstName'​)'​)"/>​ +      <action code="​$setFuncReturn('​$getFuncParam('​lastName'​),​ $getFuncParam('​firstName'​)'​)"/>​ 
-     ​</​func>​+  </​func>​
  
  
Line 38: Line 38:
 To call this user defined function, use mscript method //​$callFunc('​funcName','​param1','​param2'​)//​. For example: To call this user defined function, use mscript method //​$callFunc('​funcName','​param1','​param2'​)//​. For example:
  
-     <log msg="​Full Name is: $callFunc('​getFullName','​lastName=Smith','​firstName=John'​)"/>​+  ​<log msg="​Full Name is: $callFunc('​getFullName','​lastName=Smith','​firstName=John'​)"/>​
            
  
Line 49: Line 49:
  
  
- 
-      
Print/export
QR Code
QR Code user_defined_functions (generated for current page)