[ic] Abbreviated random search

Stefan Hornburg (Racke) racke at linuxia.de
Tue Aug 31 08:03:22 UTC 2010

On 08/31/2010 02:30 AM, Marty Tennison wrote:
> 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.

Interchange will get all matching records and perform the random selection with Perl.


LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team

More information about the interchange-users mailing list