OpenTokens™: %FUNC()%
Return to Introduction  Previous page  Next page

%FUNC()% tokens perform much like the OpenTokens™: %EXPR()% tokens and can contain complete expressions. The difference is that the %FUNC()% tokens evaluate to nothing, but instead store their return value in the g.OUIX_FuncReturn global variable. They use following token format:

%FUNC(expression)%  
 
Example: To evaluate the expression (5 * 8 / 2), you would enter %FUNC(5 * 8 / 2)%.  
 
You can also include any of the MivaScript built-in functions, such as gettoken:
 
Example: %FUNC(gettoken('a,b,c', ',', 2))% will assign the single character 'b' to the g.OUIX_FuncReturn variable.  

Below is a list of Merchant Utility functions that can be called directly in the expressions. For example, to call the Product_FindFirst function in the lib/db.mv script, you'd use:

Example: %FUNC(Product_FindFirst())%  
 
And to look up an Availability Group (for instance, called 'AG01'), you can use the token:

Example: %FUNC(AvailabilityGroup_Find_Name('AG01'))%  

And since you can nest tokens, you can also use:

Example: %SET(g.AGName|AG01)% and then do the lookup with the token %FUNC(AvailabilityGroup_Find_Name(%VAR(g.AGName)%))%  

You can also redirect a function call to any script you choose, by using this format:

%FUNC(MvDO('myscript.mvc')$Product_FindFirst())%

This will call a function called Product_FindFirst() in your myscript.mvc.


*** Note for Uncompiled OpenUI ONLY ***  
 
ONLY the specified function names listed in the below lists can be used. (This is due to a limitation of Miva Empresa that doesn't allow dynamic function name calling into external files)  
 
The functions you can use is limited to specific functions located in the following scripts:  
 
·lib/db.mv  
·lib/util.mv  
·features/aff/aff_db.mv  
·features/agr/agr_db.mv  
·features/att/att_db.mv  
·features/cus/cus_db.mv  
·features/cus/cus_rt.mv  
·features/inv/inv_db.mv  
·features/inv/inv_rt.mv  
·features/not/not_db.mv  
·features/pgr/pgr_db.mv  
·features/rpd/rpd_db.mv  
·features/sta/sta.mv  
·features/sta/sta_db.mv  
·features/stp/stp_db.mv  
·features/usl/usl_db.mv  
·features/usl/usl_rt.mv  
 
 

 


Send feedback on this documentation.
© 2004 - 2000 Darren Ehlers & OpenUI Developer Consortium