[ic] Ideas to substitute for a [query] inside a [query]?

cfm@maine.com cfm@maine.com
Thu, 15 Feb 2001 09:30:36 -0500


On Thu, Feb 15, 2001 at 02:01:12AM -0800, Dan B wrote:
> Solved it, works perfect.  :-)  Thanks to Christopher F. Miller and the 
> mailing list archive.  Hopefully this will come in handy to the next person 
> searching the archives.

That's probably relatively safe.  Still I'd suggest you make it policy to
encapsulate anything that uses minivend internals in a separate perl 
library and not in the pages.  Otherwise you will be in deep mess 
when you need to upgrade and something has changed.

> 
> [query
>          list=1
>          st=db
>          sql=|
>                  SELECT  DISTINCT category
>                  FROM    products
>                  WHERE   hcpcs IN (
>                                  SELECT  hcpcs
>                                  FROM    coverage
>                                  WHERE   carrier_idr = '[value carrier_pri]'
>                                  )
>                  ORDER BY category;
>          |
> ]
>          [set this_cat_search][sql-param category][/set]
>          [seti covered_sku_list][mvasp tables="products"]<%
>                  my $dbh = $Sql{products};
>                  my $sql_query = "SELECT sku FROM products WHERE category = 
> '$Scratch->{this_cat_search}' AND hcpcs IN ( SELECT hcpcs FROM coverage 
> WHERE carrier_idr = '$Values->{carrier_pri}') ORDER BY category;";
>                  my $sth = $dbh->prepare($sql_query)
>                  or return error_message("can't open products database");
>                  my $rc = $sth->execute()
>                          or return HTML("can't open products database");
>                  while ( $sku = $sth->fetchrow_arrayref() ) {
>                          HTML("$sku->[0]|");
>                  }
>                  return;
>          %>[/mvasp][/seti]
> 
>          [page href="scan"
>                  arg="
>                          fi=products
>                          sp=results
>                          st=db
>                          co=yes
>                          sf=sku
>                  se=[scratch covered_sku_list]nada
>                  "]
>                  [sql-param category]
>          [/page]
>          <BR>
> [/query]
> 
> 

-- 

Christopher F. Miller, Publisher                             cfm@maine.com
MaineStreet Communications, Inc         208 Portland Road, Gray, ME  04039
1.207.657.5078                                       http://www.maine.com/
Content management, electronic commerce, internet integration, Debian linux