Modified (Untested, though. If there's a bug, It'll be relatively
small):
<cfsilent>
<cfoutput query="jobapplicants">
<cfscript>
for (i=1; i LTE listlen(jobapplicants.columnlist); i=i+1) {
colName = listgetat(jobapplicants.columnlist, i);
rowNum = jobapplicants.currentrow;
querySetCell(jobapplicants,
colName,
trim(jobapplicants[colName][rowNum]),
rowNum);
}
</cfscript>
</cfoutput>
</cfsilent>
On Wed, 10 Jul 2002 11:54:31 -0400, in cf-talk you wrote:
>Ick ick ick. Remember you don't need to use evaluate for queries:
>
><cfset vCol = JobApplicants[column][rownum]>
>
>=======================================================================
>Raymond Camden, ColdFusion Jedi Master for Macromedia
>
>Email : [EMAIL PROTECTED]
>Yahoo IM : morpheus
>
>"My ally is the Force, and a powerful ally it is." - Yoda
>
>> -----Original Message-----
>> From: James Blaha [mailto:[EMAIL PROTECTED]]
>> Sent: Wednesday, July 10, 2002 11:51 AM
>> To: CF-Talk
>> Subject: Re: Issue: Trying to loop through a query and trim
>> all the fields in the table before I output them without
>> having to hardcode each field.
>>
>>
>> Jamie it didn't work. What about something like this? But its not
>> working right.
>>
>> <CFQUERY NAME="JobApplicants" DATASOURCE="HRWebAgent">
>> SELECT *
>> FROM dbo.tApply
>>
>> </CFQUERY>
>>
>> <cfoutput>#JobApplicants.ColumnList#<br></cfoutput><P>
>>
>> <CFLOOP INDEX="I" LIST="#JobApplicants.ColumnList#">
>>
>> <CFLOOP INDEX="II" FROM="1" TO="#JobApplicants.RecordCount#">
>> <CFSET vCol = evaluate("JobApplicants." & I & "[" & II & "]")>
>> <CFOUTPUT>#vCol#</CFOUTPUT><BR>
>>
>> </CFLOOP>
>>
>> </CFLOOP>
>>
>>
>> Jamie Jackson wrote:
>>
>> >Congratulations, you win the prize for longest subject line. :D
>> >
>> >I'd trim in the query itself, but if you want to:
>> >
>> ><cfquery name="jobapplicants">
>> ><cfscript>
>> >for (i=1; i LTE listlen(jobapplicants.columnlist); i=i+1) {
>> > colName = listgetat(jobapplicants.columnlist, i);
>> > querySetCell(jobapplicants, colName, trim(evaluate(colName)),
>> >jobapplicants.currentrow);
>> >}
>> ></cfscript>
>> ></cfquery>
>> >
>> >..something like that, anyway.
>> >
>> >Consider doing it in the query, though.
>> >
>> >Jamie
>> >
>> >On Wed, 10 Jul 2002 10:04:50 -0400, in cf-talk you wrote:
>> >
>> >>Hello All:
>> >>
>> >>Issue: Trying to loop through a query and trim all the
>> fields in the
>> >>table before I output them without having to hardcode each field.
>> >>.
>> >>Sincerely,
>> >>James Blaha
>> >>
>> >><CFQUERY NAME="JobApplicants" DATASOURCE="HRWebAgent">
>> >>SELECT *
>> >>
>> >>FROM dbo.tApply
>> >
>> >></CFQUERY>
>> >>
>> >>
>> >> <CFOUTPUT>
>> >> <CFLOOP QUERY="JobApplicants">
>> >>
>> >> <CFSET ValuesPassed = TRIM(#ValuesPassed#)>
>> >> #ValuesPassed#<br>
>> >>
>> >> </CFLOOP>
>> >> </CFOUTPUT>
>> >>
>> >>
>> >>This code works for form fields and I want to do the same
>> for the query
>> >>results.
>> >>
>> >><!--- To output the active variables uncomment --->
>> >> <CFOUTPUT>
>> >> <CFLOOP ITEM="ValuesPassed2" COLLECTION="#FORM#">
>> >> <!--- <CFOUTPUT><strong>Form.#ValuesPassed2#</strong> =
>> >><strong>#Form[ValuesPassed2]#</strong><br></CFOUTPUT> --->
>> >>
>> >> <CFSET ValuesPassed2 = TRIM(#FORM[ValuesPassed2]#)>
>> >> #ValuesPassed2#<br>
>> >>
>> >> </CFLOOP>
>> >> </CFOUTPUT>
>> >>
>> >>
>> >>FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
>> >>Archives: http://www.mail-archive.com/[email protected]/
>> >>Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
>> >>
>> >
>> >
>>
>
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists