Hey Ken,

One good way to do this is instead of using an if...elseif...else for all 6
prices based on a,b,etc stick a little code at the top of your page to
convert a, b, etc to a price.

Like:

<cfquery name="getPrice">
    select price
    from prices
</cfquery>

<cfset a = 0>
<...etc for a => whatever>

<cfoutput query="getPrice">
    <!--- stick processing here for setting the above variables to the
correct price. --->
</cfoutput>

You might still have to do some ifs but you will only have to do it once
instead of again and again for every record.

I think this is the jist of what you were asking, right?  Let me know if you
need some more code!

Derek

----- Original Message -----
From: "Ken Ketsdever" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, May 18, 2001 6:31 PM
Subject: setting values


> Friday, May 18, 2001 5:14 PM
>
>
>
> I have a table that is dynamically populated from a db to show the item
> number, description, price and image of products.
>
> Although there are several hundred items there are only about 6 prices.
>
> Rather than inputting the price of each item into the database, I would
> prefer to put a letter designation then set the letter to equal a price.
so
> that when prices change I only have to reset the price once per price
versus
> changing all the prices in my database.
>
> I am pulling out #price# from a query.
>
> if I use prices as a , b, c, d, ...
>
> can I use some sort of set function to establish prices to be displayed
>
> so if an item has a price code of "a" in the database it will display
$22.00
>
> if it is "b" then it will display $26.00
>
> etc...
> Or does this need to be done via a cfif statement and if so how would I do
> it
>
>
> Thank you for any help you can provide
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to