[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] sql queries inside perl tag
At 08:24 PM 8/1/01 -0700, you wrote:
<snip>
>Not tested, but the basic idea is there...
>
>[query list=1 prefix=outer sql="SELECT sun
> FROM products
> WHERE code = '[item-code]'"]
>
> [calc]
> @sunarray = split(/,/, '[outer-param sun]'); # breaks with (') in
> the field!
> $out = '';
> foreach $option (@sunarray) {
> $out .= ($out) ? ",'$option'" : "'$option'";
> }
> return '';
> [/calc]
>
>
> [query list=1 prefix=inner sql="SELECT val
> FROM sun WHERE code in ([calc]$out[/calc])'
> ORDER BY val"]
>
> [inner-param val]<br>
>
> [/query]
>
>[/query]
>
>Good luck,
>
>Kyle
Rock ON!!!!
I finally got this to work! Thanks for your example Kyle, it was nearly
flawless. Here is my working code...
[query list=1 prefix=outer sql="SELECT sun
FROM products
WHERE code = '[item-code]'"]
[calc]
@sunarray = split(/,/, '[outer-param sun]');
$out = '';
foreach $option (@sunarray) {
$out .= ($out) ? "|$option" :
"$option";
}
return '';
[/calc]
[query list=1 prefix=inner sql="SELECT val
FROM sun
WHERE code
~'([calc]$out[/calc])'"]
[inner-param val]<br>
[/query]
[/query]
Brian Kosick
Web Programmer
New Age Consulting Service, Inc.
216-619-2000
briank@nacs.net
_______________________________________________
interchange-users mailing list
interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users