Joe,

Thanks...  now, if you could illuminate a crusty old procedural programmer
and help me understand why Evaluate() shouldn't be used, I'd be
appreciative.

-matt

----------
Matthew Newby
PNS Web Services
PH:  207-438-5263
email:  [EMAIL PROTECTED]



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Joe Rinehart
Sent: Thursday, August 03, 2006 9:21 AM
To: [email protected]
Subject: Re: [Reactor for CF] How do I dynamically call get(fieldname)
met hods?


Hey Matt,

Evaluate() shouldn't be used for things like this - use cfinvoke instead:

<cfinvoke component="#record#" method="get#fieldname[i].alias#"
returnVariable="fieldValue">

#fieldValue#

Also, you'll want to use fieldname[i].alias, not fieldname[i].name.

-Joe


On 8/3/06, Newby Matthew S CONT PORT <[EMAIL PROTECTED]>
wrote:
>
>
> Dan,
>
> I did something like this:
>
> <!--- Display all the data from the fields in the USERS record --->
> <cfloop
> list="#UserRecord._getObjectMetaData().getFieldList()#"
> index="thisField">
>     #thisField# = #evaluate("UserRecord.get#thisField#()")#<br />
> </cfloop>
> Is that what you're looking for?
>
> -matt
>   ________________________________
>
>
> Matthew Newby
> PNS Web Services
> PH: 207-438-5263
> email: [EMAIL PROTECTED]
>
> When digitally signed, the signature is in accordance with DoDI 8520.2,
> dated 1 Apr 2004.
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Dan Sorensen
> Sent: Wednesday, August 02, 2006 7:51 PM
> To: [email protected]
> Subject: [Reactor for CF] How do I dynamically call get(fieldname)
methods?
>
>
>
>
>
> I want to create a dynamically generated table from the contents of a
single
> reactor record. What's the best way to dynamically call the get(fieldname)
> methods?
>
>
>
> Example (assuming reactor was already initialized as application.reactor):
>
>
>
> <!--- Get Field Names --->
>
> <cfset fieldNames =
>
application.reactor.createRecord("exampleTable")._getObjectMetaData().getFie
lds()>
>
> <!--- Get Record Data --->
>
> <cfset record =
> application.reactor.createRecord("exampleTable").load(FORM.recordNumber)>
>
>
>
> <cfoutput>
>
> <table>
>
>             <cfloop index="I" from="1" to="#arrayLen(fieldNames)#>
>
>                         <tr>
>
>
> <td>#fieldnames[i].alias#</td>
>
>                                     <td>
>
>
>                                                 HERE'S
> WHERE I'M STUCK: #record["get" & fieldname[i].name & "()"]#
>
>
> </td>
>
>                         </tr>
>
> </cfloop>
>
> </table>
>
> </cfoutput>
>
>
>
> Now, I'd like to loop over fieldNames and create a table with the field
name
> in the left column, and the data in the right column, but I don't know how
> to dynamically call the getFieldName(). With a query it would simply be:
> record[fieldname[i].name][currentrow]. I'm sure this is a
> common issue. Have I overlooked a Reactor function that deals with this?
> What's the recommended practice?
>
>
>
> Thanks,
>
> Dan
>
>
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- --
>
> Reactor for ColdFusion Mailing List
> [email protected]
> Archives at:
> http://www.mail-archive.com/reactor%40doughughes.net/
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- --
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- --
> Reactor for ColdFusion Mailing List
> [email protected]
> Archives at:
> http://www.mail-archive.com/reactor%40doughughes.net/
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- --
>


-- 
Get Glued!
The Model-Glue ColdFusion Framework
http://www.model-glue.com


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --



-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to