I would like to use CFGrid to display some data from a database.

My database has one field that contains some XML data that I need to parse and 
get some information out of to place it in the CFGrid.  Right now I am looping 
over my query and parsing the XML so I can insert it into the CFGridRow tag.

I would like to instead bind the CFGrid to a CFC and I don't see a way to parse 
the XML before it gets to my CFGrid.

The only way I can think of is to query the database in the CFC then parse the 
XML and re-build the query using QueryNew() and the other Query functions then 
return it.

Can anyone think of a better way of binding the XML data to the CFGrid?


Example XML inside of the "JobNote" field in the database:
<?xml version="1.0" encoding="UTF-8"?>
<JobNote>
        <JobStep>
                <JID>A</JID>
                <Dept>Archive</Dept>
                <Details>FTPed the files</Details>
        </JobStep>
</JobNote>


Current Code that I am manually populating my cfgridrow:
<cfform>
    <cfgrid name="FirstGrid" format="html" height="320" font="Tahoma" 
fontsize="12" selectmode="edit">
                <cfgridcolumn name="Dept" header="Dept." width="50">
                <cfgridcolumn name="Date" header="Date" width="50">
                <cfgridcolumn name="JID" header="JID" width="50">
                <cfgridcolumn name="Details" header="Details" width="450">
                
                <cfoutput query="GetJobNotes">
                        <cfset jobNoteXml = XmlParse(getJobNotes.JobNote)>
                        <cfset results = XmlSearch(jobNoteXml, 
"/JobNote/JobStep")>
                        <cfset thisJID = results[1].JID.XmlText>
                        <cfset thisDept = results[1].Dept.XmlText>
                        <cfset thisDetails = results[1].Details.XmlText>
                                
                        <cfgridrow data 
="#variables.thisDept#,#dateFormat(getJobNotes.DateCreated, 
"short")#,#variables.thisJID#,#variables.thisDetails#">
                </cfoutput>             

        </cfgrid>
</cfform>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:302340
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to