[ic] Pricing causing hang

Mike Heins interchange-users@icdevgroup.org
Fri Feb 14 23:47:01 2003


Quoting Denis Heinrichs (denis@cascadia.bc.ca):
> Hi,
> 
> Through a lot of searching of docs, posting messages, head banging, I 
> managed
> to hack together the following to help me lookup prices in a system 
> where there
> are three pricing levels.
> 
> Whenever I login as a user with a pricing level other than retail, the 
> page hangs
> and eventually comes up with a server error.  
> 
> I am testing with the following code:
> 
> [query type=list sql="select sku, description, thumb from products where 
> sku='ACC13801'"
>     prefix="sql" list_prefix="sql"]
> [sql]
>     The price is: [sql-price]
> [/sql]
> [/query]
> 
> I know my code is not very elegant....any suggestions would be greatly 
> appreciated.
> 
> Here is my code:
> 
> CommonAdjust   "[lookup-pricing table='discounts' 'retail']", ;:price, 
> ==:options
> 
> Profile level1 { CommonAdjust => "[lookup-pricing table='discounts' 
> 'level1'], ;:discounts:level1 ;:level1" }
> Profile level2 { CommonAdjust => "[lookup-pricing table='discounts' 
> 'level2'], ;:discounts:level2 ;:level2" }
> Profile level3 { CommonAdjust => "[lookup-pricing table='discounts' 
> 'level3'], ;:discounts:level3 ;:level3" }
> Profile default { CommonAdjust => '[lookup-pricing table="discounts" 
> "retail"], ;:price, ==:options' }

Not right -- each atom needs to be quoted. That *is* documented. Also,
you don't have your tag syntax right either -- mixing named and
positional parameters. That is documented too.

Probably you want:

 CommonAdjust   "[lookup-pricing table='discounts' whatever-you-meant='retail']", ;:price, ==:options

 Profile level1 <<EOR
 {
    CommonAdjust =>
      '"[lookup-pricing table=discounts whatever=level1]", ;:discounts:level1 ;:level1',
 }
 EOR

etc.

You can use variables and aliases to make things more readable. Put in:

    UserTag  ldisc Alias  lookup-pricing table=discounts whatever=
    CommonAdjust   "[ldisc retail]", ;:price, ==:options

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

Nature, to be commanded, must be obeyed. -- Francis Bacon