extract and resuse values from a structure
I have a page called "shopping_cart_qry.cfm", that does a series of SELECT
queries from various tables. It extracts data and populates a single structure called shopping
. This structure contains around 50 parameters, like:
shopping.company_id
shopping.brand_id
shopping.cost_Price
shopping.expiry_dt
shopping.user_id
shopping.item_name
shopping.item_cost
...
I only need 15 out of the 50 parameters (shopping.item_name
, shopping.item_cost
, etc) for a different task. So I am calling "shopping_cart_qry.cfm" as <cfinclude>
in a new file named "item_info.cfm".
In this file when I do an <cfdump>
of the structure, I see all 50 parameters, including the 15 parameters I need. But when I try to assign new names to the 15 parameters I need like this:
<cfset itemName = "shopping.item_name">
<cfset itemCost = "shopping.item_Cost">
<cfset itemDt = "shopping.item_Dt">
And then use <cfdump>
to see I was able to do successfully, I am seeing the variable names (itemName, itemCost, etc..) b开发者_如何学运维ut no values.
<cfdump var="#shopping.item_name#">
<cfdump var="#shopping.item_Cost#">
<cfdump var="#shopping.item_Dt#">
Should I use <script>
?
You should remove the quotation marks, ex:
<cfset itemName = shopping.item_name>
See Adobe docs on cfset.
精彩评论