[ic] Abbreviated random search

Marty Tennison marty at dripdepot.com
Tue Aug 31 00:30:59 UTC 2010


On Monday, August 30, 2010 01:58:12 pm Tom Friedel wrote:
> I inherited many instances of something like this
> 
> [loop search="
> fi=products/st=db/co=1/sf=prod_group/se=Parts/op=rm/nu=0/ml=1 "]
> 
> and want to do a Mysql search with 'order by rand()' and 'order by
> rand(seed)'
> 
> I tried /tf/rand() with no luck.
> 
> The code actually looks like
> 
> [loop random="[control matches 100]"  serch=...
> 
> and I am not sure what the random= does if anything because it is not
> documented with loop tag.
> 
> Is there anyway I can keep the structure of this code and use the mysql
> 'order by rand(seed) functionality?

The following code works for me and returns random results. (IC=5.7.2)

[loop search="ra=yes" random="3"]
	[loop-field category] [loop-field title]<br>
[/loop] 

I am not sure how the "random=" parameter gets its results but I imagine you 
could set 'DataTrace   1' in your config file and see the actual sql statement 
that is being made to the DB.



- - -- ---- ---------------------------------------------------- --- -- - -
Marty Tennison Drip Depot Inc 
email: marty at dripdepot.com
web: www.dripdepot.com
- -- --- ------------------------------------------------------------- --- --
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.icdevgroup.org/pipermail/interchange-users/attachments/20100830/5ac117d4/attachment.htm>


More information about the interchange-users mailing list