using openser 1.3, is there a way to get a count of how many items there are in an avp variable other than:<br>while ( is_avp_set(&quot;$avp(s:fork_uri)&quot;) ) <br>&nbsp;&nbsp; &nbsp;{<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;$var(fork_uri_count) = $var(fork_uri_count) + 1 ;
<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;avp_copy(&quot;$avp(s:fork_uri)&quot;, &quot;$avp(s:fork_uri_rev_order)/d&quot;) ;<br>&nbsp;&nbsp; &nbsp;}<br>then if you wanted things in the same order as they were originally you would also have to:<br>while ( is_avp_set(&quot;$avp(s:fork_uri_rev_order)&quot;) ) 
<br>&nbsp;&nbsp; &nbsp;{<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;avp_copy(&quot;$avp(s:fork_uri_rev_order)&quot;, &quot;$avp(s:fork_uri)/d&quot;) ;<br>&nbsp;&nbsp; &nbsp;}<br><br>talk about an expensive counting<br><br>Several ways I could see this implimented:<br>&nbsp;&nbsp; New function avp_count(&quot;$avp(s:myvar)&quot;, &quot;$avp(s:count_result)&quot;)
or avp_count(&quot;$avp(s:myvar)&quot;) where $rc contains the result.<br>&nbsp;&nbsp; is_avp_set(&quot;$avp(s:myvar)&quot;) where $rc is set to the count, probably best as you could test if exitst and the go right to processing.<br>
&nbsp;&nbsp; avp_check(&quot;$avp(s:myvar)&quot;, &quot;cn/g&quot;) where $rc is set to the count. It could always set $rc to count of found matches
for when the g flag is used.<br>Of course using $rc for is_avp_set() or avp_check() depends on if setting that to non-zero makes a test like if( is_avp_set(&quot;$avp(s:myvar)&quot;) ) always trigger as false.<br><br>also on getting a count ...
<br><br>another place I need to get a count is how many times a character(s) (or shoot the moon, a regex) occurs in a string.<br>for handeling things like transformations like {s.select,index,seperator}, eg: $(var(findme){
s.select,$var(count),,})&nbsp;&nbsp; <br>&nbsp; sidenote ... (not sure what values for seperator are valid)<br>a transformation like {s.count,seperator}<br><br>Here is an example of something I was trying to do that would have benifited from knowing the count of seperator.
<br>I think that I got a warning or error when the test for the while indexed past the end of the string.<br><br>xlog(&quot;L_INFO&quot;, &quot;Original findme list to parse: $avp(s:findme)\n&quot;);<br>if ( $avp(s:findme) =~ &quot;\|&quot; )
<br>{<br>&nbsp;&nbsp; &nbsp;$var(findme) = $(avp(s:findme){s.select,0,|}) ;<br>&nbsp;&nbsp; &nbsp;$var(findme_tm_out) = $(avp(s:findme){s.select,1,|}) ;<br>&nbsp;&nbsp; &nbsp;xlog(&quot;L_INFO&quot;, &quot;This findme has a timeout: $var(findme_tm_out)\n&quot;);<br>

}<br>else<br>{<br>&nbsp;&nbsp; &nbsp;$var(findme) = $avp(s:findme) ;<br>}<br>xlog(&quot;L_INFO&quot;, &quot;findme list to parse: $var(findme)\n&quot;);<br>$var(findme_cnt) = 0 ;<br>while ($(var(findme){s.select,$var(findme_cnt),,}{s.len

}) &gt; 0&nbsp; )<br>{<br>&nbsp;&nbsp; &nbsp;xlog(&quot;L_INFO&quot;, &quot;Loop $var(findme_cnt), Adding $(var(findme){s.select,$var(findme_cnt),,}) to TO_list\n&quot;);<br>&nbsp;&nbsp; &nbsp;$avp(s:TO_list) = $(var(findme){s.select,$var(findme_cnt),,}) ;
<br>&nbsp;&nbsp; &nbsp;$var(findme_cnt) = $var(findme_cnt) + 1 ;<br>}<br><br>can/do $var()&#39;s stack like $avp()&#39;s?<br><br>Thanks<br>Dave<br>