Adobe COLDFUSION 9 Manual page 1088

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using Web Elements and External Objects
<cfquery name="priceQuery" dbType="query">
SELECT SUM(qty*unitPrice)
AS totalPrice
FROM orderquery
</cfquery>
<cfset discountPrice = priceQuery.totalPrice * (1 - drate/100)>
<!--- Display the full price and discounted price --->
<cfoutput>
<b>Full Price=</b> #priceQuery.totalPrice#<br>
<b>Discount Price=</b> #discountPrice#
</cfoutput>
<br><br>
<!---Generate an XML Receipt --->
<cfxml variable="receiptxml">
<receipt num = "34">
<cfoutput>
<price>#discountPrice#</price>
<cfif drate GT 0 >
<discountRate>#drate#</discountRate>
</cfif>
</cfoutput>
<itemsFilled>
<cfoutput query="orderQuery">
<name>#name# </name>
<qty> #qty# </qty>
<price> #qty*unitPrice# </price>
</cfoutput>
</itemsFilled>
</receipt>
</cfxml>
<!--- Display the resulting receipt --->
<cfdump var=#receiptxml#>
Reviewing the code
The following table describes the CFML code and its function. For the sake of brevity, it does not include code that
displays the processing results.
Last updated 8/5/2010
1083

Advertisement

Table of Contents
loading

Table of Contents