Link | rp_param |
Author | Randy Phillips |
Category | Client |
Version | 8.5.x |
License | Public Domain |
Posted | 25 Jun 2007 |
Updated | 13 Jul 2007 |
More by this author... |
I created this tag to bypass the "built in" error that occurs when the find->get element does not exist in a pair array. It gets values from pair arrays such as client_postparams or client_getparams without throwing an error when the element does not exist. Instead it silently returns a NULL value.
local('fruit' = (array: 'item1' = 'apples', 'item2' = 'bananas', 'item1' = 'strawberries', 'item3' = 'oranges')); (rp_param: -pairs=(#fruit), -find='item1'); //->apples (rp_param: -pairs=(#fruit), -find='item1', -instance=2); //->strawberries (rp_param: -pairs=(#fruit), -find='item1', -instance=3); //->NULL (rp_param: -pairs=(#fruit), -find='item7'); //->NULL
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define_tag:'param', -namespace='rp_', -required='pairs', -type=array, -required='find', -optional='instance'; !(local_defined:'instance') ? local('instance' = 1); !(local_defined:'value') ? local('value' = NULL); local('param_count' = #pairs->(find:#find)->size); loop(#param_count); local('value' = #instance <= (loop_count) ? #pairs->(find:#find)->(get:#instance)->value | NULL); /loop; return: #value; /define_tag;
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Horray!