Solved

when working with a WDDX packet is there a way to loop through the fieldNames

Posted on 2008-10-21
1
802 Views
Last Modified: 2011-09-20
I would like to be able to loop through the fieldnames of a wddx packet and place them into a strcut.  

I use this line to convert it back to cfm <cfwddx action="wddx2cfml" input="#wddxPacket#" output="orders">

So how do I use this to loop through the fieldnames?
<wddxPacket version='1.0'><header/><data><struct><var name='Customer_Addresses'><recordset rowCount='1' fieldNames='STRTABLE,GUIDADDRESSID,GUIDCUSTOMERID,INTADDRESSTYPE,TXTCOMPANYNAME,TXTNAME,TXTADDRESS1,TXTADDRESS2,TXTADDRESS3,TXTCITY,TXTSTATE,TXTZIP,INTCOUNTRYID,TXTPHONE,TXTFAX,TXTEMAIL,DATCREATED' type='coldfusion.sql.QueryTable'>
<field name='STRTABLE'>
<string>Customer_Addresses</string></field><field name='GUIDADDRESSID'><string>1c570882-c506-4b20-8a0b-55c58c5b33ef</string></field><field name='GUIDCUSTOMERID'><string>583d703a-75c9-412f-aaef-fcfac72d095d</string></field><field name='INTADDRESSTYPE'><number>0.0</number></field><field name='TXTCOMPANYNAME'><string></string></field><field name='TXTNAME'><string>michael thompson</string></field><field name='TXTADDRESS1'><string>235 s. bebe</string></field><field name='TXTADDRESS2'><string></string></field><field name='TXTADDRESS3'><string></string></field><field name='TXTCITY'><string>wichita</string></field><field name='TXTSTATE'><string>KS</string></field><field name='TXTZIP'><string>67209</string></field><field name='INTCOUNTRYID'><number>1.0</number></field><field name='TXTPHONE'><string>3169450278</string></field><field name='TXTFAX'><string></string></field><field name='TXTEMAIL'><string></string></field><field name='DATCREATED'><dateTime>2008-8-6T20:14:1-5:0</dateTime></field></recordset></var>

Open in new window

0
Comment
Question by:monica73174
1 Comment
 
LVL 14

Accepted Solution

by:
Scott Bennett earned 500 total points
ID: 22772348
When you use cfwddx to convert the wddx to cfml it automatically creates a structure with the variable name you specify in the output parameter. based on your wddx packet it looks like it would create a coldfusion structure named orders that has a structkey of customer_addresses that contains a query result set. You could loop through that result set like this:


<cfwddx action="CFML2WDDX" input="#mywddxstring#"  output="orders">
 
<cfoutput query="orders.Customer_Addresses">
#orders.Customer_Addresses.STRTABLE#<bt>
#orders.Customer_Addresses.GUIDADDRESSID#<br>
#orders.Customer_Addresses.GUIDCUSTOMERID#<br><br>
</cfoutput>

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question