I'm returning data back from a database and want to populate variables the same way as columns are named. I have this working fine (though any suggested improvements are welcome), but when the values are undefined, in this case at least, I'd like to make the variable have a '' (empty quotes) instead for repopulating form fields. I'm not sure how to test for undefined.
Here's the code: <cfset the_db = StructNew()> <cfoutput query="#the_db_name#"> <cfloop list="#evaluate('#the_db_name#.columnlist')#" index="col"> <cfset the_db_info[col] = evaluate('#the_db_name#[col][currentRow]')> <!--- attempting to make undefined an empty string ---> <cfif the_db_info[col] EQ undefined> <cfset the_db_info[col] = ''> </cfif> #col#:#the_db_info[col]#<br> </cfloop> </cfoutput> -- Daniel Kessler Department of Public and Community Health University of Maryland Suite 2387 Valley Drive College Park, MD 20742-2611 301-405-2545 Phone www.phi.umd.edu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210197 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54