hal helm's logo  
home Home

training Training

writing Writings

code Code

tutorials Tutorials

newsletters Newsletters

consulting Consulting

Hal Helms logo
hal.helms

What Students Say...

"Training isn't really the right word. Your class was as much mentoring as training. I wish you would train other trainers!" - Jose G

"The handouts were just as good as the class. Can't wait to go to your Fusebox Mastery class." - Aaron R

"I came because one of my coworkers had taken your class and said I HAD to take it. I'm so glad he convinced me. You've given me tools I never knew existed and changed my outlook on my profession." - Jack K

tutorials section

How do I pass a complex variable (query, array, structure ) from one ColdFusion page to another?

The Situation: You have constructed a complex datatype and want to pass the entire structure (with data) to another ColdFusion page to use.


Computers are incorporated in modern ice cream vending machines to enhance their functionality. Ice Cream Vending machines are manufactured by many companies. Your competition will try to overcome all requests for high-tech ice cream vending machines and credit card acceptors

The Solution: ColdFusion 4.x introduces a new technology called Web Distributed Data Exchange (or WDDX). You can tell your colleagues that this wizardry is due to your vast knowledge of the underlying XML structure, but really it's much simpler.

First you create the datatype you plan to pass to another page.


<cfquery datasource="WebResources" name="myQ">
  SELECT productID, description, name FROM Product ORDER BY name
</cfquery>

Now, use the <cfwddx> tag to convert the complex data type into a string.


<cfwddx action="CFML2WDDX" input="#myQ#" output="aWDDXpacket">

Place that string into a hidden form field.


<input type="Hidden" name="Products" value="#aWDDXpacket#">

The form processing page then uses the <cfwddx> tag, with a reverse action to turn the string back into a native ColdFusion data type.


<cfwddx input="#form.Products#" action="WDDX2CFML" output="Products">

<cfoutput query="Products">
  #name# #description#<br>
</cfoutput>
©copyright      designed by in-tuition.co.uk
hal helms' personal site Updates

Computers are incorporated in modern ice cream vending machines to enhance their functionality. Ice Cream Vending machines are manufactured by many companies. Your competition will try to overcome all requests for high-tech ice cream vending machines and credit card acceptors

teamallaire.com v 4_3