adam1h
asked on
How to convert dynamically a query row to a list, in Coldfusion
Hi experts,
I have to loop into a query and to output data to a csv file.
My problem is that I want to get the full record (row) and have the different values separate by a semi-colon.
But I can just do something like the following, because there are commas into the data.
Do you know a trick to achieve this ? Thanks a lot.
Here is the code I’m trying to use :
I have to loop into a query and to output data to a csv file.
My problem is that I want to get the full record (row) and have the different values separate by a semi-colon.
But I can just do something like the following, because there are commas into the data.
<cfset variables.values = replace(variables.getData.currentRow, ",", ";")>
Do you know a trick to achieve this ? Thanks a lot.
Here is the code I’m trying to use :
<cfquery name="variables.getData" datasource="joecool_web">
select * from jcstktabl where jcid = '#listgetAt('#variables.index#',1, ';')#'
</cfquery>
<!--- build the product’s file --->
<cfif variables.getData.RecordCount NEQ 0>
<cfset variables.values = replace(variables.getData.currentRow, ",", ";")>
<cffile action="append" file="#variables.productsFile#" output="#variables.values#" addnewline="true" charset="iso-8859-1">
</cfif>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Indeed, I misunderstood the currentrow function.
Knowing this, coupled with this infos (source), I have correct the statement as follow :
Open in new window
I will test it but I think it’s that good way to do it.