Reddot cms IoRangeList inside IoRangePreExecute

256 views Asked by At

Hi i don't have RedDot CMS and i want to know is it possible to use <!IoRangeList> inside <!IoRangePreExecute> also use ASP Classic to get sum of the elements inside for loop.

Or is the other way to do it

Here is my code

 <!IoRangePreExecute>   
 <%
 Dim a(5), b, c
 %>
 <% d = 0 %>
 <!IoRangeList>
   ' user range list as loop to get value from reddot
   a(<% d = d + 1 %>) = <%value%>
 <!/IoRangeList>     
 <% For Each b in a
    c = c + Cint(b)
    Next 
    Response.Write(c)
 %>
 <!/IoRangePreExecute>

Im wondering is the correct way to do it

2

There are 2 answers

3
Tony Gayter On BEST ANSWER

It would be easier to use the built in foreach loop tag, but yes you can do this that way(although the code in the rangelist isn't complete)

0
Silas On

It is possible, but I would not recommend it. PreExecute is very inefficient, avoid if you can.

Prior to my recent departure from OpenText, I generally used iorangelist to output client-side code - perhaps as javascript data - and then used JS/JQuery to build a dynamic UI from this.

For your specific question, I would simply output the List loop as a client-side javascript:

<script>
var a = 0;

<%iorangelist%>
a += <%value%>;  //I'd check for numeric here.
<%/iorangelist%>

console.log(a);
</script>