RE: EACHMULTI / SETMULTI, Adrian Fitton, 12-05-2008
by Roger Harris, December 27, 2008 19:10
Sorry to take so long. I couldn't get it to work, either, but when I went to debug it, I realized that I was testing with an old version that didn't have support for the $var( ) function in EACHMULTI. The key is that, when you call a function, you can only pass values, not variables, and those values will be copied to local variables in the function. However, you can pass the name of a variable and then use the $var( ) function to treat that as the name of a variable, and resolve the variable's value. You need to do that in both the EACHMULTI statement and in the code that uses the EACHMULTI variables. So, this does work in the latest release:
<% FUNCTION implode(theSeperator, result); SET theresult=""; EACHMULTI $var($result$); SET theresult=$theresult$$theSeperator$$var($result$); ENDMULTI; RETURN $mid($theresult$,2); %>
(The $mid function in the return strips off the first separator.)
If this doesn't work for you, you must also have an old version. Send me an email and I'll send you the latest version.
Name E-mail optional TopicMessage:
HTTP Link: Link text: