That'd be fantastic<div>$avp(s:values) = "8,5,6,9,2,4,5";</div><div>$var(value_count) = $(avp(s:values){s.csv.count(\,)});</div><div>$var(value_third)=$(avp(s:values){s.csv.select(\,,3)});</div><div>$avp(s:value_array) = $(avp(s:values){s.csv.split(\,)});</div>
<div># Makes:</div><div># $avp(s:value_array)[0]=8;</div><div># $avp(s:value_array)[1]=5;</div><div># ...</div><div>$avp(s:new_values) = $(avp(s:value_array){s.csv.join(\,)});<br># Makes $avp(s:new_values) == $avp(s:values);</div>
<div>... you get the idea.. typical string -> array funcs</div><div><br></div><div><br></div><div>push, pop, first, last, min, max, avg.. All of those functions would be really really really nice. Especially if they can handle floats. :D :D</div>
<div>-Brett</div><div><br></div><div><div class="gmail_quote">On Mon, Jun 21, 2010 at 8:40 AM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Ah, I see :) ....maybe we can make an new "csv" transformation....<br>
<br>
Regards,<br>
Bogdan<br>
<div class="im"><br>
Brett Nemeroff wrote:<br>
> Bogdan,<br>
> Brad's AVP is a single AVP with CSV. He'd like to count the elements<br>
> in the CSV.<br>
><br>
> Some string array functions would be nice. :D<br>
> -Brett<br>
><br>
><br>
> On Mon, Jun 21, 2010 at 6:46 AM, Bogdan-Andrei Iancu<br>
</div><div class="im">> <<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a> <mailto:<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>>> wrote:<br>
><br>
> Hi Brad,<br>
><br>
> I guess you are looking for the set_count() function:<br>
><br>
> <a href="http://www.opensips.org/html/docs/modules/1.6.x/cfgutils.html#id228574" target="_blank">http://www.opensips.org/html/docs/modules/1.6.x/cfgutils.html#id228574</a><br>
><br>
> Regards,<br>
> Bogdan<br>
><br>
><br>
> --<br>
> Bogdan-Andrei Iancu<br>
> OpenSIPS Bootcamp<br>
> 20 - 24 September 2010, Frankfurt, Germany<br>
</div>> <a href="http://www.voice-system.ro" target="_blank">www.voice-system.ro</a> <<a href="http://www.voice-system.ro" target="_blank">http://www.voice-system.ro</a>><br>
<div><div></div><div class="h5">><br>
><br>
><br>
> Brad Bendy wrote:<br>
> > Brett,<br>
> ><br>
> > I figured as much, but I thought I would try anyways.<br>
> ><br>
> > I think adding the "count" to the front the string is going to be<br>
> > easiest method and use the select functions, much more simpler!<br>
> ><br>
> > Thanks for the advice.<br>
> ><br>
> > On Sat, 2010-06-19 at 20:41 -0500, Brett Nemeroff wrote:<br>
> ><br>
> >> Brad,<br>
> >> param.count is for URI parameters and can't be used for any old<br>
> >> format. If your string was in URI param format, I think it<br>
> would then<br>
> >> work:<br>
> >> <a href="http://www.opensips.org/Resources/DocsCoreTran16#toc36" target="_blank">http://www.opensips.org/Resources/DocsCoreTran16#toc36</a><br>
> >><br>
> >><br>
> >> I haven't used this transformation, but it appears you'd take the<br>
> >> params off a URI and then use the transformations on the params<br>
> >> themselves.<br>
> >><br>
> >><br>
> >> I think what I do to find out if I'm at the end is to use the<br>
> "select'<br>
> >> transformation and check the value of the return.<br>
> >><br>
> >><br>
> >> Alternatively, you *could* make the first element in your list the<br>
> >> number of values to expect. Not sure if that's even an option<br>
> in your<br>
> >> case..<br>
> >><br>
> >><br>
> >> -Brett<br>
> >><br>
> >><br>
> >><br>
> >><br>
> >> On Sat, Jun 19, 2010 at 8:34 PM, Brad Bendy<br>
> >> <<a href="mailto:brad.bendy@benganetworks.com">brad.bendy@benganetworks.com</a><br>
</div></div><div class="im">> <mailto:<a href="mailto:brad.bendy@benganetworks.com">brad.bendy@benganetworks.com</a>>> wrote:<br>
> >> Hi list,<br>
> >><br>
> >> Ive got a AVP that gets a value from a memcached store,<br>
> it's a<br>
> >> set of<br>
> >> integers separated by commas , ex: 4,34,1,10<br>
> >><br>
> >> Is there a way to return the number of entries? In this<br>
> case<br>
> >> id like to<br>
> >> have a 4 returned.<br>
> >><br>
> >> I cannot get {param.count} to work, but im not sure if it<br>
> >> works like<br>
> >> this or maybe im just not using is right.<br>
> >><br>
> >> Thanks for any help or suggestions<br>
> >><br>
> >><br>
> >><br>
> >><br>
> >> _______________________________________________<br>
> >> Users mailing list<br>
</div>> >> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>><br>
<div class="im">> >> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
> >><br>
> >><br>
> >> _______________________________________________<br>
> >> Users mailing list<br>
</div>> >> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>><br>
<div class="im">> >> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
> >><br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > Users mailing list<br>
</div>> > <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>><br>
<div class="im">> > <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
> ><br>
> ><br>
><br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
</div>> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>><br>
<div class="im">> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
><br>
><br>
> ------------------------------------------------------------------------<br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
><br>
<br>
<br>
</div>--<br>
<div class="im">Bogdan-Andrei Iancu<br>
OpenSIPS Bootcamp<br>
20 - 24 September 2010, Frankfurt, Germany<br>
<a href="http://www.voice-system.ro" target="_blank">www.voice-system.ro</a><br>
<br>
<br>
</div><div><div></div><div class="h5">_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br></div>